Patchwork [2,of,2] check-code: use new function for compiling regexp patterns

login
register
mail settings
Submitter Simon Heimberg
Date June 12, 2013, 11:34 p.m.
Message ID <a5e7c7c3710716c8cb7c.1371080091@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1721/
State Rejected, archived
Headers show

Comments

Simon Heimberg - June 12, 2013, 11:34 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1371079559 -7200
# Node ID a5e7c7c3710716c8cb7ca9c9b4148882336880bb
# Parent  bc083daefc5b468586c15623e483a7e8358688b7
check-code: use new function for compiling regexp patterns

This gives some speed gain when re2 is installed.

Patch

diff -r bc083daefc5b -r a5e7c7c37107 contrib/check-code.py
--- a/contrib/check-code.py	Don Jun 13 01:25:24 2013 +0200
+++ b/contrib/check-code.py	Don Jun 13 01:25:59 2013 +0200
@@ -347,10 +347,10 @@ 
                 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
 
                 #print po, '=>', p
-                pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
+                pats[i] = (compilere(p, multiline=True),) + pseq[1:]
         filters = c[2]
         for i, flt in enumerate(filters):
-            filters[i] = re.compile(flt[0]), flt[1]
+            filters[i] = compilere(flt[0]), flt[1]
 _preparepats()
 
 class norepeatlogger(object):