summaryrefslogtreecommitdiffstats
path: root/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-03-17 11:54:50 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-06-22 18:20:40 +0200
commitc6bd8c706a799eb0fece99f468aaa22b818036f3 (patch)
treef6f5c9119c642fee35cdd98957c3bfd30527a76d /qapi
parent75158ebbe259f0bd8bf435e8f4827a43ec89c877 (diff)
downloadhqemu-c6bd8c706a799eb0fece99f468aaa22b818036f3.zip
hqemu-c6bd8c706a799eb0fece99f468aaa22b818036f3.tar.gz
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>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/opts-visitor.c24
-rw-r--r--qapi/qapi-visit-core.c28
-rw-r--r--qapi/qmp-dispatch.c12
-rw-r--r--qapi/qmp-input-visitor.c28
-rw-r--r--qapi/string-input-visitor.c24
5 files changed, 58 insertions, 58 deletions
diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
index f2ad6d7..7ae33b3 100644
--- a/qapi/opts-visitor.c
+++ b/qapi/opts-visitor.c
@@ -173,7 +173,7 @@ opts_end_struct(Visitor *v, Error **errp)
const QemuOpt *first;
first = g_queue_peek_head(any);
- error_set(errp, QERR_INVALID_PARAMETER, first->name);
+ error_setg(errp, QERR_INVALID_PARAMETER, first->name);
}
g_hash_table_destroy(ov->unprocessed_opts);
ov->unprocessed_opts = NULL;
@@ -193,7 +193,7 @@ lookup_distinct(const OptsVisitor *ov, const char *name, Error **errp)
list = g_hash_table_lookup(ov->unprocessed_opts, name);
if (!list) {
- error_set(errp, QERR_MISSING_PARAMETER, name);
+ error_setg(errp, QERR_MISSING_PARAMETER, name);
}
return list;
}
@@ -341,8 +341,8 @@ opts_type_bool(Visitor *v, bool *obj, const char *name, Error **errp)
strcmp(opt->str, "n") == 0) {
*obj = false;
} else {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
- "on|yes|y|off|no|n");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
+ "on|yes|y|off|no|n");
return;
}
} else {
@@ -403,9 +403,9 @@ opts_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp)
}
}
}
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
- (ov->list_mode == LM_NONE) ? "an int64 value" :
- "an int64 value or range");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
+ (ov->list_mode == LM_NONE) ? "an int64 value" :
+ "an int64 value or range");
}
@@ -455,9 +455,9 @@ opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp)
}
}
}
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
- (ov->list_mode == LM_NONE) ? "a uint64 value" :
- "a uint64 value or range");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
+ (ov->list_mode == LM_NONE) ? "a uint64 value" :
+ "a uint64 value or range");
}
@@ -477,8 +477,8 @@ opts_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp)
val = strtosz_suffix(opt->str ? opt->str : "", &endptr,
STRTOSZ_DEFSUFFIX_B);
if (val < 0 || *endptr) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
- "a size value representible as a non-negative int64");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
+ "a size value representible as a non-negative int64");
return;
}
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index a18ba16..5a7c900 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -110,8 +110,8 @@ void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp)
value = *obj;
v->type_int(v, &value, name, errp);
if (value < 0 || value > UINT8_MAX) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
- "uint8_t");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ name ? name : "null", "uint8_t");
return;
}
*obj = value;
@@ -128,8 +128,8 @@ void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp
value = *obj;
v->type_int(v, &value, name, errp);
if (value < 0 || value > UINT16_MAX) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
- "uint16_t");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ name ? name : "null", "uint16_t");
return;
}
*obj = value;
@@ -146,8 +146,8 @@ void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp
value = *obj;
v->type_int(v, &value, name, errp);
if (value < 0 || value > UINT32_MAX) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
- "uint32_t");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ name ? name : "null", "uint32_t");
return;
}
*obj = value;
@@ -177,8 +177,8 @@ void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp)
value = *obj;
v->type_int(v, &value, name, errp);
if (value < INT8_MIN || value > INT8_MAX) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
- "int8_t");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ name ? name : "null", "int8_t");
return;
}
*obj = value;
@@ -195,8 +195,8 @@ void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp)
value = *obj;
v->type_int(v, &value, name, errp);
if (value < INT16_MIN || value > INT16_MAX) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
- "int16_t");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ name ? name : "null", "int16_t");
return;
}
*obj = value;
@@ -213,8 +213,8 @@ void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp)
value = *obj;
v->type_int(v, &value, name, errp);
if (value < INT32_MIN || value > INT32_MAX) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
- "int32_t");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ name ? name : "null", "int32_t");
return;
}
*obj = value;
@@ -271,7 +271,7 @@ void output_type_enum(Visitor *v, int *obj, const char * const strings[],
assert(strings);
while (strings[i++] != NULL);
if (value < 0 || value >= i - 1) {
- error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null");
+ error_setg(errp, QERR_INVALID_PARAMETER, name ? name : "null");
return;
}
@@ -303,7 +303,7 @@ void input_type_enum(Visitor *v, int *obj, const char * const strings[],
}
if (strings[value] == NULL) {
- error_set(errp, QERR_INVALID_PARAMETER, enum_str);
+ error_setg(errp, QERR_INVALID_PARAMETER, enum_str);
g_free(enum_str);
return;
}
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 2227420..7bcc860 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -27,8 +27,8 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
QDict *dict = NULL;
if (qobject_type(request) != QTYPE_QDICT) {
- error_set(errp, QERR_QMP_BAD_INPUT_OBJECT,
- "request is not a dictionary");
+ error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT,
+ "request is not a dictionary");
return NULL;
}
@@ -41,19 +41,19 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
if (!strcmp(arg_name, "execute")) {
if (qobject_type(arg_obj) != QTYPE_QSTRING) {
- error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
- "string");
+ error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
+ "string");
return NULL;
}
has_exec_key = true;
} else if (strcmp(arg_name, "arguments")) {
- error_set(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
+ error_setg(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
return NULL;
}
}
if (!has_exec_key) {
- error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
+ error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
return NULL;
}
diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
index f6dab1a..e97b8a4 100644
--- a/qapi/qmp-input-visitor.c
+++ b/qapi/qmp-input-visitor.c
@@ -105,7 +105,7 @@ static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)
if (g_hash_table_size(top_ht)) {
const char *key;
g_hash_table_find(top_ht, always_true, &key);
- error_set(errp, QERR_QMP_EXTRA_MEMBER, key);
+ error_setg(errp, QERR_QMP_EXTRA_MEMBER, key);
}
g_hash_table_unref(top_ht);
}
@@ -122,8 +122,8 @@ static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind,
Error *err = NULL;
if (!qobj || qobject_type(qobj) != QTYPE_QDICT) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "QDict");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "QDict");
return;
}
@@ -163,8 +163,8 @@ static void qmp_input_start_list(Visitor *v, const char *name, Error **errp)
QObject *qobj = qmp_input_get_object(qiv, name, true);
if (!qobj || qobject_type(qobj) != QTYPE_QLIST) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "list");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "list");
return;
}
@@ -215,7 +215,7 @@ static void qmp_input_get_next_type(Visitor *v, int *kind, const int *qobjects,
QObject *qobj = qmp_input_get_object(qiv, name, false);
if (!qobj) {
- error_set(errp, QERR_MISSING_PARAMETER, name ? name : "null");
+ error_setg(errp, QERR_MISSING_PARAMETER, name ? name : "null");
return;
}
*kind = qobjects[qobject_type(qobj)];
@@ -228,8 +228,8 @@ static void qmp_input_type_int(Visitor *v, int64_t *obj, const char *name,
QObject *qobj = qmp_input_get_object(qiv, name, true);
if (!qobj || qobject_type(qobj) != QTYPE_QINT) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "integer");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "integer");
return;
}
@@ -243,8 +243,8 @@ static void qmp_input_type_bool(Visitor *v, bool *obj, const char *name,
QObject *qobj = qmp_input_get_object(qiv, name, true);
if (!qobj || qobject_type(qobj) != QTYPE_QBOOL) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "boolean");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "boolean");
return;
}
@@ -258,8 +258,8 @@ static void qmp_input_type_str(Visitor *v, char **obj, const char *name,
QObject *qobj = qmp_input_get_object(qiv, name, true);
if (!qobj || qobject_type(qobj) != QTYPE_QSTRING) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "string");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "string");
return;
}
@@ -274,8 +274,8 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name,
if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT &&
qobject_type(qobj) != QTYPE_QINT)) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "number");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "number");
return;
}
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index d8a8db0..bbd6a54 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -185,8 +185,8 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,
StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v);
if (!siv->string) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "integer");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "integer");
return;
}
@@ -217,8 +217,8 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,
return;
error:
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, name,
- "an int64 value or range");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name,
+ "an int64 value or range");
}
static void parse_type_size(Visitor *v, uint64_t *obj, const char *name,
@@ -231,8 +231,8 @@ static void parse_type_size(Visitor *v, uint64_t *obj, const char *name,
if (siv->string) {
parse_option_size(name, siv->string, &val, &err);
} else {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "size");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "size");
return;
}
if (err) {
@@ -263,8 +263,8 @@ static void parse_type_bool(Visitor *v, bool *obj, const char *name,
}
}
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "boolean");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "boolean");
}
static void parse_type_str(Visitor *v, char **obj, const char *name,
@@ -274,8 +274,8 @@ static void parse_type_str(Visitor *v, char **obj, const char *name,
if (siv->string) {
*obj = g_strdup(siv->string);
} else {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "string");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "string");
}
}
@@ -291,8 +291,8 @@ static void parse_type_number(Visitor *v, double *obj, const char *name,
val = strtod(siv->string, &endp);
}
if (!siv->string || errno || endp == siv->string || *endp) {
- error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "number");
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "number");
return;
}
OpenPOWER on IntegriCloud