[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] build: compat-xlat-header.py: optimisation to search for just '{' instead of [{}]
commit df4daa15ee029b76d447c3cae903ab830f21963e Author: Anthony PERARD <anthony.perard@xxxxxxxxxx> AuthorDate: Thu Jan 19 15:22:56 2023 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon Feb 6 10:22:12 2023 +0000 build: compat-xlat-header.py: optimisation to search for just '{' instead of [{}] `fields` and `extrafields` always all the parts of a sub-struct, so when there is '}', there is always a '{' before it. Also, both are lists. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/tools/compat-xlat-header.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/tools/compat-xlat-header.py b/xen/tools/compat-xlat-header.py index ae5c9f11c9..2b805b23a8 100644 --- a/xen/tools/compat-xlat-header.py +++ b/xen/tools/compat-xlat-header.py @@ -8,7 +8,6 @@ re_identifier = re.compile(r'^[a-zA-Z_]') re_compat_handle = re.compile(r'^COMPAT_HANDLE\((.*)\)$') re_pad = re.compile(r'^_pad\d*$') re_compat = re.compile(r'^compat_.*_t$') -re_brackets = re.compile(r'[{}]') def removeprefix(s, prefix): if s.startswith(prefix): @@ -105,7 +104,7 @@ def handle_field(prefix, name, id, type, fields): else: k = id.replace('.', '_') print("%sXLAT_%s_HNDL_%s(_d_, _s_);" % (prefix, name, k), end='') - elif not re_brackets.search(' '.join(fields)): + elif not '{' in fields: tag = ' '.join(fields) tag = re.sub(r'\s*(struct|union)\s+(compat_)?(\w+)\s.*', '\\3', tag) print(" \\") @@ -290,7 +289,7 @@ def build_body(name, tokens): print(" \\\n} while (0)") def check_field(kind, name, field, extrafields): - if not re_brackets.search(' '.join(extrafields)): + if not '{' in extrafields: print("; \\") if len(extrafields) != 0: for token in extrafields: -- generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |