aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-07 20:35:57 +0400
committerMarkus Armbruster <armbru@redhat.com>2017-06-19 14:56:29 +0200
commit58634047b7deeab36e4b07c4744e44d698975561 (patch)
tree1a8f91542326a283ca50bb4ecaeebd2d38d097f2
parentc1214ad3dcf392ca3d9354c8a811c76f0d4c45ce (diff)
downloadqemu-58634047b7deeab36e4b07c4744e44d698975561.zip
qemu-58634047b7deeab36e4b07c4744e44d698975561.tar.gz
qemu-58634047b7deeab36e4b07c4744e44d698975561.tar.bz2
qapi: Clean up qobject_input_type_number() control flow
Use the more common pattern to error out. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170607163635.17635-6-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r--qapi/qobject-input-visitor.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index eac40f6..26ef49a 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -547,13 +547,13 @@ static void qobject_input_type_number(Visitor *v, const char *name, double *obj,
}
qfloat = qobject_to_qfloat(qobj);
- if (qfloat) {
- *obj = qfloat_get_double(qobject_to_qfloat(qobj));
+ if (!qfloat) {
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
+ full_name(qiv, name), "number");
return;
}
- error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
- full_name(qiv, name), "number");
+ *obj = qfloat_get_double(qobject_to_qfloat(qobj));
}
static void qobject_input_type_number_keyval(Visitor *v, const char *name,