|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] include: speed up compat header generation
commit 91f59d2041b0f2760da082827bcea57648845cc1
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 25 15:10:21 2017 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 25 15:10:21 2017 +0100
include: speed up compat header generation
Recent additions to xlat.lst have apparently resulted in Python's
garbage collection getting in the way: I would guess that so far it
managed to re-use previously compiled regular expressions, but with the
higher number of them now can't anymore (at least with default
settings). Do the compilation explicitly. While at it, combine the two
lists, and avoid using re.subn() when re.sub() suffices.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/tools/compat-build-source.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py
index 55206e6..595bc3f 100755
--- a/xen/tools/compat-build-source.py
+++ b/xen/tools/compat-build-source.py
@@ -12,19 +12,18 @@ pats = [
[ r"XEN_GUEST_HANDLE(_[0-9A-Fa-f]+)?", r"COMPAT_HANDLE" ],
];
-xlats = []
-
xlatf = open('xlat.lst', 'r')
for line in xlatf.readlines():
match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip())
if match[1]:
- xlats.append(match[0])
+ pats.append([ r"(struct|union)\s+(%s|xen_%s)\s+(\w)" % (match[0],
match[0]),
+ r"\1 @KeeP@\2 \3" ])
xlatf.close()
+for pat in pats:
+ pat[0] = re.compile(pat[0])
+
for line in sys.stdin.readlines():
for pat in pats:
- line = re.subn(pat[0], pat[1], line)[0]
- for xlat in xlats:
- line = re.subn(r"(struct|union)\s+(%s|xen_%s)\s+(\w)" % (xlat, xlat),
- r"\1 @KeeP@\2 \3", line.rstrip())[0]
+ line = re.sub(pat[0], pat[1], line)
print line.rstrip()
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |