diff options
author | Eric Blake <eblake@redhat.com> | 2016-03-03 09:16:43 -0700 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-03-05 10:40:52 +0100 |
commit | 14f00c6c492488381a513c3816b15794446231a0 (patch) | |
tree | 731a0989018d6a9f7a312ffd87485d3adba3b070 /scripts/qapi-visit.py | |
parent | 96a1616c85ae62fc13aff85a34effb4b2477b7ce (diff) |
qapi: Rename 'fields' to 'members' in generator
C types and JSON objects don't have fields, but members. We
shouldn't gratuitously invent terminology. This patch is a
strict renaming of generator code internals (including testsuite
comments), before later patches rename C interfaces.
No change to generated code with this patch.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1457021813-10704-2-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi-visit.py')
-rw-r--r-- | scripts/qapi-visit.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 2308268a62..b21d3ef200 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -15,9 +15,9 @@ from qapi import * import re -# visit_type_FOO_fields() is always emitted; track if a forward declaration +# visit_type_FOO_members() is always emitted; track if a forward declaration # or implementation has already been output. -struct_fields_seen = set() +object_members_seen = set() def gen_visit_decl(name, scalar=False): @@ -30,10 +30,10 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_type)sobj, Error ** c_name=c_name(name), c_type=c_type) -def gen_visit_fields_decl(typ): - if typ.name in struct_fields_seen: +def gen_visit_members_decl(typ): + if typ.name in object_members_seen: return '' - struct_fields_seen.add(typ.name) + object_members_seen.add(typ.name) return mcgen(''' static void visit_type_%(c_type)s_fields(Visitor *v, %(c_type)s *obj, Error **errp); @@ -41,18 +41,18 @@ static void visit_type_%(c_type)s_fields(Visitor *v, %(c_type)s *obj, Error **er c_type=typ.c_name()) -def gen_visit_struct_fields(name, base, members, variants): +def gen_visit_object_members(name, base, members, variants): ret = '' if base: - ret += gen_visit_fields_decl(base) + ret += gen_visit_members_decl(base) if variants: for var in variants.variants: # Ugly special case for simple union TODO get rid of it if not var.simple_union_type(): - ret += gen_visit_fields_decl(var.type) + ret += gen_visit_members_decl(var.type) - struct_fields_seen.add(name) + object_members_seen.add(name) ret += mcgen(''' static void visit_type_%(c_name)s_fields(Visitor *v, %(c_name)s *obj, Error **errp) @@ -69,7 +69,7 @@ static void visit_type_%(c_name)s_fields(Visitor *v, %(c_name)s *obj, Error **er c_type=base.c_name()) ret += gen_err_check() - ret += gen_visit_fields(members, prefix='obj->') + ret += gen_visit_members(members, prefix='obj->') if variants: ret += mcgen(''' @@ -108,7 +108,7 @@ static void visit_type_%(c_name)s_fields(Visitor *v, %(c_name)s *obj, Error **er } ''') - # 'goto out' produced for base, by gen_visit_fields() for each member, + # 'goto out' produced for base, by gen_visit_members() for each member, # and if variants were present if base or members or variants: ret += mcgen(''' @@ -174,7 +174,7 @@ def gen_visit_alternate(name, variants): if var.type.alternate_qtype() == 'QTYPE_QINT': promote_int = 'false' if isinstance(var.type, QAPISchemaObjectType): - ret += gen_visit_fields_decl(var.type) + ret += gen_visit_members_decl(var.type) ret += mcgen(''' @@ -235,10 +235,10 @@ out: def gen_visit_object(name, base, members, variants): - ret = gen_visit_struct_fields(name, base, members, variants) + ret = gen_visit_object_members(name, base, members, variants) # FIXME: if *obj is NULL on entry, and visit_start_struct() assigns to - # *obj, but then visit_type_FOO_fields() fails, we should clean up *obj + # *obj, but then visit_type_FOO_members() fails, we should clean up *obj # rather than leaving it non-NULL. As currently written, the caller must # call qapi_free_FOO() to avoid a memory leak of the partial FOO. ret += mcgen(''' |