diff options
author | Eric Blake <eblake@redhat.com> | 2016-01-29 06:48:49 -0700 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:31:49 -0600 |
commit | b2221a0e9c3c33bcdad3fc6b28809c72334b68a1 (patch) | |
tree | f8999192d60637b8b9421353212810fe82571cc0 /include/qapi/visitor-impl.h | |
parent | 01b3c8e954e7dd2e157ed8072662362556a039bd (diff) | |
download | hqemu-b2221a0e9c3c33bcdad3fc6b28809c72334b68a1.zip hqemu-b2221a0e9c3c33bcdad3fc6b28809c72334b68a1.tar.gz |
qapi: Prefer type_int64 over type_int in visitors
The qapi builtin type 'int' is basically shorthand for the type
'int64'. In fact, since no visitor was providing the optional
type_int64() callback, visit_type_int64() was just always falling
back to type_int(), cementing the equivalence between the types.
However, some visitors are providing a type_uint64() callback.
For purposes of code consistency, it is nicer if all visitors
use the paired type_int64/type_uint64 names rather than the
mismatched type_int/type_uint64. So this patch just renames
the signed int callbacks in place, dropping the type_int()
callback as redundant, and a later patch will focus on the
unsigned int callbacks.
Add some FIXMEs to questionable reuse of errp in code touched
by the rename, while at it (the reuse works as long as the
callbacks don't modify value when setting an error, but it's not
a good example to set) - a later patch will then fix those.
No change in functionality here, although further cleanups are
in the pipeline.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1454075341-13658-14-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'include/qapi/visitor-impl.h')
-rw-r--r-- | include/qapi/visitor-impl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index f314894..319efe8 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -36,7 +36,10 @@ struct Visitor void (*get_next_type)(Visitor *v, QType *type, bool promote_int, const char *name, Error **errp); - void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error **errp); + /* Must be set. */ + void (*type_int64)(Visitor *v, int64_t *obj, const char *name, + Error **errp); + /* Must be set. */ void (*type_bool)(Visitor *v, bool *obj, const char *name, Error **errp); void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp); void (*type_number)(Visitor *v, double *obj, const char *name, @@ -54,7 +57,6 @@ struct Visitor void (*type_int8)(Visitor *v, int8_t *obj, const char *name, Error **errp); void (*type_int16)(Visitor *v, int16_t *obj, const char *name, Error **errp); void (*type_int32)(Visitor *v, int32_t *obj, const char *name, Error **errp); - void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); bool (*start_union)(Visitor *v, bool data_present, Error **errp); |