Message ID | 20200428163419.4483-5-armbru@redhat.com |
---|---|
State | New |
Headers | show |
Series | qom: Spring cleaning | expand |
On 4/28/20 11:34 AM, Markus Armbruster wrote: > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > include/qom/object.h | 4 ++-- > hw/core/machine-qmp-cmds.c | 6 +++--- > qom/object.c | 9 +++++---- > 3 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/include/qom/object.h b/include/qom/object.h > index ccfa82e33d..5d1ed672c3 100644 > --- a/include/qom/object.h > +++ b/include/qom/object.h > @@ -1331,8 +1331,8 @@ int object_property_get_enum(Object *obj, const char *name, Adding context: /** * object_property_get_uint16List: * @obj: the object * @name: the name of the property * @list: the returned int list * @errp: returns an error if this function fails * * Returns: the value of the property, converted to integers, or > * undefined if an error occurs (including when the property value is not > * an list of integers). > */ > -void object_property_get_uint16List(Object *obj, const char *name, > - uint16List **list, Error **errp); > +uint16List *object_property_get_uint16List(Object *obj, const char *name, > + Error **errp); Incomplete. The doc comments need to drop the @list line, as well as s/undefined/#NULL/ in the Returns line. With that fixed, Reviewed-by: Eric Blake <eblake@redhat.com>
Eric Blake <eblake@redhat.com> writes: > On 4/28/20 11:34 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> --- >> include/qom/object.h | 4 ++-- >> hw/core/machine-qmp-cmds.c | 6 +++--- >> qom/object.c | 9 +++++---- >> 3 files changed, 10 insertions(+), 9 deletions(-) >> >> diff --git a/include/qom/object.h b/include/qom/object.h >> index ccfa82e33d..5d1ed672c3 100644 >> --- a/include/qom/object.h >> +++ b/include/qom/object.h >> @@ -1331,8 +1331,8 @@ int object_property_get_enum(Object *obj, const char *name, > > Adding context: > > /** > * object_property_get_uint16List: > * @obj: the object > * @name: the name of the property > * @list: the returned int list > * @errp: returns an error if this function fails > * > * Returns: the value of the property, converted to integers, or > >> * undefined if an error occurs (including when the property value is not >> * an list of integers). >> */ >> -void object_property_get_uint16List(Object *obj, const char *name, >> - uint16List **list, Error **errp); >> +uint16List *object_property_get_uint16List(Object *obj, const char *name, >> + Error **errp); > > Incomplete. The doc comments need to drop the @list line, as well as > s/undefined/#NULL/ in the Returns line. Will fix. > With that fixed, > Reviewed-by: Eric Blake <eblake@redhat.com> Thanks!
diff --git a/include/qom/object.h b/include/qom/object.h index ccfa82e33d..5d1ed672c3 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1331,8 +1331,8 @@ int object_property_get_enum(Object *obj, const char *name, * undefined if an error occurs (including when the property value is not * an list of integers). */ -void object_property_get_uint16List(Object *obj, const char *name, - uint16List **list, Error **errp); +uint16List *object_property_get_uint16List(Object *obj, const char *name, + Error **errp); /** * object_property_set: diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index eed5aeb2f7..f3a28035fc 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -325,9 +325,9 @@ static int query_memdev(Object *obj, void *opaque) "policy", "HostMemPolicy", &error_abort); - object_property_get_uint16List(obj, "host-nodes", - &m->value->host_nodes, - &error_abort); + m->value->host_nodes = object_property_get_uint16List(obj, + "host-nodes", + &error_abort); m->next = *list; *list = m; diff --git a/qom/object.c b/qom/object.c index 9c74749193..ddb021db21 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1559,10 +1559,11 @@ int object_property_get_enum(Object *obj, const char *name, return ret; } -void object_property_get_uint16List(Object *obj, const char *name, - uint16List **list, Error **errp) +uint16List *object_property_get_uint16List(Object *obj, const char *name, + Error **errp) { Error *err = NULL; + uint16List *list = NULL; Visitor *v; char *str; @@ -1575,11 +1576,11 @@ void object_property_get_uint16List(Object *obj, const char *name, visit_complete(v, &str); visit_free(v); v = string_input_visitor_new(str); - visit_type_uint16List(v, NULL, list, errp); - + visit_type_uint16List(v, NULL, &list, errp); g_free(str); out: visit_free(v); + return list; } void object_property_parse(Object *obj, const char *string,
Signed-off-by: Markus Armbruster <armbru@redhat.com> --- include/qom/object.h | 4 ++-- hw/core/machine-qmp-cmds.c | 6 +++--- qom/object.c | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-)