summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-10 23:40:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-10 23:40:40 +0300
commite08c40aa7260c5bb84b61a759179e9b081d03a80 (patch)
treea689e3b0d9b3d893a8ba6bec5ae94cfd0398e3a0
parent24481e228f0d64f878b34b028c0dc03d2a4a5f7e (diff)
downloadhercules-e08c40aa7260c5bb84b61a759179e9b081d03a80.tar.gz
hercules-e08c40aa7260c5bb84b61a759179e9b081d03a80.tar.bz2
hercules-e08c40aa7260c5bb84b61a759179e9b081d03a80.tar.xz
hercules-e08c40aa7260c5bb84b61a759179e9b081d03a80.zip
Improve performance in validateinterfaces.py.
-rwxr-xr-xtools/validateinterfaces.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/tools/validateinterfaces.py b/tools/validateinterfaces.py
index 8c794cb7c..a4222adb5 100755
--- a/tools/validateinterfaces.py
+++ b/tools/validateinterfaces.py
@@ -119,18 +119,20 @@ def checkFile(tracker, cFile):
print "Checking: " + cFile
with open(cFile, "r") as r:
for line in r:
- for method in tracker.methods:
- idx = line.find(method)
- if idx > 0:
- if idx + len(method) >= len(line):
- continue
- if checkChr(line[idx + len(method)]):
- continue
- if checkChr(line[idx - 1]):
- continue
- if line[-1] == "\n":
- line = line[:-1]
- tracker.arr[method].append(line)
+ parts = re.findall(r'[\w_]+', line)
+ for part in parts:
+ if part in tracker.methods:
+ idx = line.find(part)
+ if idx > 0:
+ if idx + len(part) >= len(line):
+ continue
+ if checkChr(line[idx + len(part)]):
+ continue
+ if checkChr(line[idx - 1]):
+ continue
+ if line[-1] == "\n":
+ line = line[:-1]
+ tracker.arr[part].append(line)
def processDir(tracker, srcDir):
files = os.listdir(srcDir)