diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-04-12 18:00:18 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-06-18 15:14:38 +0200 |
commit | 89bfe000433a601d30729086e88519ff36b85103 (patch) | |
tree | e0d6b15a4dff198c4eec81369a13aaa47c0d1f0e /qom | |
parent | 8cb6789a31e8c5823b36d84416433c145a1e6442 (diff) |
qom: Push error reporting to object_property_find()
Avoids duplicated error_set().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Also drop error_set() in object_property_del().]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qom')
-rw-r--r-- | qom/object.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/qom/object.c b/qom/object.c index e072e895bb..00bb3b029c 100644 --- a/qom/object.c +++ b/qom/object.c @@ -672,7 +672,8 @@ void object_property_add(Object *obj, const char *name, const char *type, QTAILQ_INSERT_TAIL(&obj->properties, prop, node); } -ObjectProperty *object_property_find(Object *obj, const char *name) +ObjectProperty *object_property_find(Object *obj, const char *name, + Error **errp) { ObjectProperty *prop; @@ -682,15 +683,14 @@ ObjectProperty *object_property_find(Object *obj, const char *name) } } + error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); return NULL; } void object_property_del(Object *obj, const char *name, Error **errp) { - ObjectProperty *prop = object_property_find(obj, name); - + ObjectProperty *prop = object_property_find(obj, name, errp); if (prop == NULL) { - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); return; } @@ -708,10 +708,8 @@ void object_property_del(Object *obj, const char *name, Error **errp) void object_property_get(Object *obj, Visitor *v, const char *name, Error **errp) { - ObjectProperty *prop = object_property_find(obj, name); - + ObjectProperty *prop = object_property_find(obj, name, errp); if (prop == NULL) { - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); return; } @@ -725,10 +723,8 @@ void object_property_get(Object *obj, Visitor *v, const char *name, void object_property_set(Object *obj, Visitor *v, const char *name, Error **errp) { - ObjectProperty *prop = object_property_find(obj, name); - + ObjectProperty *prop = object_property_find(obj, name, errp); if (prop == NULL) { - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); return; } @@ -881,10 +877,8 @@ char *object_property_print(Object *obj, const char *name, const char *object_property_get_type(Object *obj, const char *name, Error **errp) { - ObjectProperty *prop = object_property_find(obj, name); - + ObjectProperty *prop = object_property_find(obj, name, errp); if (prop == NULL) { - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); return NULL; } @@ -1067,7 +1061,7 @@ gchar *object_get_canonical_path(Object *obj) Object *object_resolve_path_component(Object *parent, gchar *part) { - ObjectProperty *prop = object_property_find(parent, part); + ObjectProperty *prop = object_property_find(parent, part, NULL); if (prop == NULL) { return NULL; } |