Index: tools/pragmaonce/pragmaonce.py |
diff --git a/tools/pragmaonce/pragmaonce.py b/tools/pragmaonce/pragmaonce.py |
index d3a24c5336e2dc7bb9b25858dbab59622a5d561f..2375b5896e0e27819a2627b3fa574c9903058fde 100644 |
--- a/tools/pragmaonce/pragmaonce.py |
+++ b/tools/pragmaonce/pragmaonce.py |
@@ -7,7 +7,7 @@ import sys |
# A tool to add "#pragma once" lines to files that don't have it yet. |
# Intended usage: |
-# find chrome -name '*.h' -exec python tools/pragmaonce/pragmaonce.py {} \; |
+# find chrome -name '*.h' -exec python tools/pragmaonce/pragmaonce.py {} \; |
# Some files have absurdly long comments at the top |
NUM_LINES_TO_SCAN_FOR_GUARD = 250 |
@@ -19,8 +19,8 @@ def main(filename): |
index = -1 |
for i in xrange(min(NUM_LINES_TO_SCAN_FOR_GUARD, len(lines) - 1)): |
- m1 = re.match(r'^#ifndef ([A-Z_]+)', lines[i]) |
- m2 = re.match(r'^#define ([A-Z_]+)', lines[i + 1]) |
+ m1 = re.match(r'^#ifndef ([A-Z_0-9]+$)', lines[i]) |
Mark Mentovai
2010/07/26 18:58:42
I would take the $ out of the () in each of these.
Nico
2010/07/26 20:13:02
d'ohne
|
+ m2 = re.match(r'^#define ([A-Z_0-9]+$)', lines[i + 1]) |
Mark Mentovai
2010/07/26 18:58:42
This would probably perform slightly better if you
|
if m1 and m2: |
if m1.group(1) != m2.group(1): |
print 'Skipping', filename, \ |