Blame SOURCES/kvm-qapi-make-visit_type_size-fallback-to-type_int.patch

0a122b
From 9bce100f4930cb500127110999c63474e9a6cfe2 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <9bce100f4930cb500127110999c63474e9a6cfe2.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:17:00 +0100
0a122b
Subject: [PATCH 05/56] qapi: make visit_type_size fallback to type_int
0a122b
MIME-Version: 1.0
0a122b
Content-Type: text/plain; charset=UTF-8
0a122b
Content-Transfer-Encoding: 8bit
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-6-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56310
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 05/57] qapi: make visit_type_size fallback to type_int
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
From: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
0a122b
0a122b
Currently visit_type_size checks if the visitor's type_size function pointer is
0a122b
NULL. If not, it calls it, otherwise it calls v->type_uint64(). But neither of
0a122b
these pointers are ever set. Fallback to calling v->type_int() in this third
0a122b
(default) case.
0a122b
0a122b
Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
0a122b
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
0a122b
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
Reviewed-by: Andreas Färber <afaerber@suse.de>
0a122b
Message-id: 1375109277-25561-6-git-send-email-imammedo@redhat.com
0a122b
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
(cherry picked from commit b887796217b7f5b754657e85760693e4ced63356)
0a122b
---
0a122b
 qapi/qapi-visit-core.c | 11 ++++++++++-
0a122b
 1 file changed, 10 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 qapi/qapi-visit-core.c | 11 ++++++++++-
0a122b
 1 file changed, 10 insertions(+), 1 deletion(-)
0a122b
0a122b
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
0a122b
index d6a4012..6451a21 100644
0a122b
--- a/qapi/qapi-visit-core.c
0a122b
+++ b/qapi/qapi-visit-core.c
0a122b
@@ -263,8 +263,17 @@ void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp)
0a122b
 
0a122b
 void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp)
0a122b
 {
0a122b
+    int64_t value;
0a122b
     if (!error_is_set(errp)) {
0a122b
-        (v->type_size ? v->type_size : v->type_uint64)(v, obj, name, errp);
0a122b
+        if (v->type_size) {
0a122b
+            v->type_size(v, obj, name, errp);
0a122b
+        } else if (v->type_uint64) {
0a122b
+            v->type_uint64(v, obj, name, errp);
0a122b
+        } else {
0a122b
+            value = *obj;
0a122b
+            v->type_int(v, &value, name, errp);
0a122b
+            *obj = value;
0a122b
+        }
0a122b
     }
0a122b
 }
0a122b
 
0a122b
-- 
0a122b
1.7.11.7
0a122b