diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-02-11 10:35:59 +0100 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2018-03-02 13:14:10 -0600 |
commit | f9c146399dabefb8cd13c9c467a9e710af15ea70 (patch) | |
tree | 7a52384f0b3e5bf358c4f91b882e4be872bbc992 /scripts/qapi | |
parent | cdb6610ae4283720037bae2af1f78bd40eb5fe71 (diff) |
qapi/common: Fix guardname() for funny filenames
guardname() fails to return a valid C identifier for arguments
containing anything but [A-Za-z0-9_.-']. Fix that. Don't bother
protecting ticklish identifiers; header guards are all-caps, and no
ticklish identifiers are.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180211093607.27351-22-armbru@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r-- | scripts/qapi/common.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 547656c8b2..069ec3715d 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1867,7 +1867,7 @@ def mcgen(code, **kwds): def guardname(filename): - return c_name(filename, protect=False).upper() + return re.sub(r'[^A-Za-z0-9_]', '_', filename).upper() def guardstart(name): |