mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
qerror: Clean up QERR_ macros to expand into a single string
These macros expand into error class enumeration constant, comma,
string. Unclean. Has been that way since commit 13f59ae
.
The error class is always ERROR_CLASS_GENERIC_ERROR since the previous
commit.
Clean up as follows:
* Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and
delete it from the QERR_ macro. No change after preprocessing.
* Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into
error_setg(...). Again, no change after preprocessing.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
75158ebbe2
commit
c6bd8c706a
54 changed files with 367 additions and 363 deletions
12
qom/object.c
12
qom/object.c
|
@ -926,7 +926,7 @@ void object_property_get(Object *obj, Visitor *v, const char *name,
|
|||
}
|
||||
|
||||
if (!prop->get) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
prop->get(obj, v, prop->opaque, name, errp);
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ void object_property_set(Object *obj, Visitor *v, const char *name,
|
|||
}
|
||||
|
||||
if (!prop->set) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
prop->set(obj, v, prop->opaque, name, errp);
|
||||
}
|
||||
|
@ -968,7 +968,7 @@ char *object_property_get_str(Object *obj, const char *name,
|
|||
}
|
||||
qstring = qobject_to_qstring(ret);
|
||||
if (!qstring) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
|
||||
retval = NULL;
|
||||
} else {
|
||||
retval = g_strdup(qstring_get_str(qstring));
|
||||
|
@ -1029,7 +1029,7 @@ bool object_property_get_bool(Object *obj, const char *name,
|
|||
}
|
||||
qbool = qobject_to_qbool(ret);
|
||||
if (!qbool) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean");
|
||||
retval = false;
|
||||
} else {
|
||||
retval = qbool_get_bool(qbool);
|
||||
|
@ -1060,7 +1060,7 @@ int64_t object_property_get_int(Object *obj, const char *name,
|
|||
}
|
||||
qint = qobject_to_qint(ret);
|
||||
if (!qint) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "int");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "int");
|
||||
retval = -1;
|
||||
} else {
|
||||
retval = qint_get_int(qint);
|
||||
|
@ -1304,7 +1304,7 @@ static Object *object_resolve_link(Object *obj, const char *name,
|
|||
} else if (!target) {
|
||||
target = object_resolve_path(path, &ambiguous);
|
||||
if (target || ambiguous) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type);
|
||||
} else {
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue