mirror of
https://github.com/mii443/qemu.git
synced 2025-08-31 11:29:26 +00:00
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:
committed by
Eric Blake
parent
cdb6610ae4
commit
f9c146399d
@ -1867,7 +1867,7 @@ def mcgen(code, **kwds):
|
|||||||
|
|
||||||
|
|
||||||
def guardname(filename):
|
def guardname(filename):
|
||||||
return c_name(filename, protect=False).upper()
|
return re.sub(r'[^A-Za-z0-9_]', '_', filename).upper()
|
||||||
|
|
||||||
|
|
||||||
def guardstart(name):
|
def guardstart(name):
|
||||||
|
Reference in New Issue
Block a user