unicorn/qemu/scripts
Eric Blake f5c93aa7ab
qapi-visit: Less indirection in visit_type_Foo_fields()
We were passing 'Foo **obj' to the internal helper function, but
all uses within the helper were via reads of '*obj'. Refactor
things to pass one less level of indirection, by having the
callers dereference before calling.

For an example of the generated code change:

|-static void visit_type_BalloonInfo_fields(Visitor *v, BalloonInfo **obj, Error **errp)
|+static void visit_type_BalloonInfo_fields(Visitor *v, BalloonInfo *obj, Error **errp)
| {
| Error *err = NULL;
|
|- visit_type_int(v, "actual", &(*obj)->actual, &err);
|+ visit_type_int(v, "actual", &obj->actual, &err);
| error_propagate(errp, err);
| }
|
|@@ -261,7 +261,7 @@ void visit_type_BalloonInfo(Visitor *v,
| if (!*obj) {
| goto out_obj;
| }
|- visit_type_BalloonInfo_fields(v, obj, &err);
|+ visit_type_BalloonInfo_fields(v, *obj, &err);
| out_obj:

The refactoring will also make it easier to reuse the helpers in
a future patch when implicit structs are stored directly in the
parent struct rather than boxed through a pointer.

Backports commit 655519030b5d20967ae3afa1fe91ef5ad4406065 from qemu
2018-02-20 16:00:37 -05:00
..
create_config
make_device_config.sh
ordereddict.py
qapi-event.py qapi: Drop unused 'kind' for struct/enum visit 2018-02-19 23:43:54 -05:00
qapi-types.py qapi: Swap visit_* arguments for consistent 'name' placement 2018-02-19 22:45:07 -05:00
qapi-visit.py qapi-visit: Less indirection in visit_type_Foo_fields() 2018-02-20 16:00:37 -05:00
qapi.py qapi: Forbid 'any' inside an alternate 2018-02-20 15:47:16 -05:00