From: Vasilis Liaskovitis Date: Mon, 29 Jul 2013 14:47:55 +0000 (+0200) Subject: qapi: make visit_type_size fallback to type_int X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~1494 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b887796217b7f5b754657e85760693e4ced63356;p=sdk%2Femulator%2Fqemu.git qapi: make visit_type_size fallback to type_int Currently visit_type_size checks if the visitor's type_size function pointer is NULL. If not, it calls it, otherwise it calls v->type_uint64(). But neither of these pointers are ever set. Fallback to calling v->type_int() in this third (default) case. Signed-off-by: Vasilis Liaskovitis Signed-off-by: Hu Tao Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Reviewed-by: Andreas Färber Message-id: 1375109277-25561-6-git-send-email-imammedo@redhat.com Signed-off-by: Anthony Liguori --- diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index d6a4012..6451a21 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -263,8 +263,17 @@ void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp) void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp) { + int64_t value; if (!error_is_set(errp)) { - (v->type_size ? v->type_size : v->type_uint64)(v, obj, name, errp); + if (v->type_size) { + v->type_size(v, obj, name, errp); + } else if (v->type_uint64) { + v->type_uint64(v, obj, name, errp); + } else { + value = *obj; + v->type_int(v, &value, name, errp); + *obj = value; + } } }