Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: tools/pragmaonce/pragmaonce.py

Issue 3056020: Review comments for pragmaonce.py (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, \
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698