mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: Swap 'name' in visit_* callbacks to match public API
As explained in the previous patches, matching argument order of 'name, &value' to JSON's "name":value makes sense. However, while the last two patches were easy with Coccinelle, I ended up doing this one all by hand. Now all the visitor callbacks match the main interface. The compiler is able to enforce that all clients match the changed interface in visitor-impl.h, even where two pointers are being swapped, because only one of the two pointers is const (if that were not the case, then C's looseness on treating 'char *' like 'void *' would have made review a bit harder). Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1454075341-13658-21-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
d7bce9999d
commit
0b2a0d6bb2
8 changed files with 95 additions and 93 deletions
|
@ -122,7 +122,7 @@ static void format_string(StringOutputVisitor *sov, Range *r, bool next,
|
|||
}
|
||||
}
|
||||
|
||||
static void print_type_int64(Visitor *v, int64_t *obj, const char *name,
|
||||
static void print_type_int64(Visitor *v, const char *name, int64_t *obj,
|
||||
Error **errp)
|
||||
{
|
||||
StringOutputVisitor *sov = to_sov(v);
|
||||
|
@ -198,16 +198,16 @@ static void print_type_int64(Visitor *v, int64_t *obj, const char *name,
|
|||
}
|
||||
}
|
||||
|
||||
static void print_type_uint64(Visitor *v, uint64_t *obj, const char *name,
|
||||
static void print_type_uint64(Visitor *v, const char *name, uint64_t *obj,
|
||||
Error **errp)
|
||||
{
|
||||
/* FIXME: print_type_int64 mishandles values over INT64_MAX */
|
||||
int64_t i = *obj;
|
||||
print_type_int64(v, &i, name, errp);
|
||||
print_type_int64(v, name, &i, errp);
|
||||
}
|
||||
|
||||
static void print_type_size(Visitor *v, uint64_t *obj, const char *name,
|
||||
Error **errp)
|
||||
static void print_type_size(Visitor *v, const char *name, uint64_t *obj,
|
||||
Error **errp)
|
||||
{
|
||||
StringOutputVisitor *sov = to_sov(v);
|
||||
static const char suffixes[] = { 'B', 'K', 'M', 'G', 'T', 'P', 'E' };
|
||||
|
@ -237,14 +237,14 @@ static void print_type_size(Visitor *v, uint64_t *obj, const char *name,
|
|||
string_output_set(sov, out);
|
||||
}
|
||||
|
||||
static void print_type_bool(Visitor *v, bool *obj, const char *name,
|
||||
static void print_type_bool(Visitor *v, const char *name, bool *obj,
|
||||
Error **errp)
|
||||
{
|
||||
StringOutputVisitor *sov = to_sov(v);
|
||||
string_output_set(sov, g_strdup(*obj ? "true" : "false"));
|
||||
}
|
||||
|
||||
static void print_type_str(Visitor *v, char **obj, const char *name,
|
||||
static void print_type_str(Visitor *v, const char *name, char **obj,
|
||||
Error **errp)
|
||||
{
|
||||
StringOutputVisitor *sov = to_sov(v);
|
||||
|
@ -258,7 +258,7 @@ static void print_type_str(Visitor *v, char **obj, const char *name,
|
|||
string_output_set(sov, out);
|
||||
}
|
||||
|
||||
static void print_type_number(Visitor *v, double *obj, const char *name,
|
||||
static void print_type_number(Visitor *v, const char *name, double *obj,
|
||||
Error **errp)
|
||||
{
|
||||
StringOutputVisitor *sov = to_sov(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue