mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 05:05:38 +00:00
qapi-visit: Use common idiom in gen_visit_fields_decl()
We have several instances of methods that do an early exit if output is not needed, then log that output is being generated, and finally produce the output; see qapi-types.py:gen_object() and qapi-visit.py:gen_visit_implicit_struct(). The odd man out was gen_visit_fields_decl(); rearrange it to be more like the others. No semantic change or difference to generated code. Backports commit 2208d64998c5f867ccee7eeee298971685bf822d from qemu
This commit is contained in:
parent
b513481b9a
commit
dc706426c9
|
@ -34,15 +34,14 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_type)sobj, Error **
|
|||
|
||||
|
||||
def gen_visit_fields_decl(typ):
|
||||
ret = ''
|
||||
if typ.name not in struct_fields_seen:
|
||||
ret += mcgen('''
|
||||
if typ.name in struct_fields_seen:
|
||||
return ''
|
||||
struct_fields_seen.add(typ.name)
|
||||
return mcgen('''
|
||||
|
||||
static void visit_type_%(c_type)s_fields(Visitor *v, %(c_type)s *obj, Error **errp);
|
||||
''',
|
||||
c_type=typ.c_name())
|
||||
struct_fields_seen.add(typ.name)
|
||||
return ret
|
||||
c_type=typ.c_name())
|
||||
|
||||
def gen_visit_implicit_struct(typ):
|
||||
if typ in implicit_structs_seen:
|
||||
|
|
Loading…
Reference in a new issue