mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
cdb6610ae4
commit
f9c146399d
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue