Commit b8877962 authored by Vasilis Liaskovitis's avatar Vasilis Liaskovitis Committed by Anthony Liguori
Browse files

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: default avatarVasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: default avatarHu Tao <hutao@cn.fujitsu.com>
Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarAndreas Färber <afaerber@suse.de>
Message-id: 1375109277-25561-6-git-send-email-imammedo@redhat.com
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent c52dc697
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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;
        }
    }
}