From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1fNU-0005ha-9i for qemu-devel@nongnu.org; Tue, 23 Jul 2013 12:23:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1fNS-0006xv-Sx for qemu-devel@nongnu.org; Tue, 23 Jul 2013 12:23:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1fNS-0006xn-LQ for qemu-devel@nongnu.org; Tue, 23 Jul 2013 12:23:54 -0400 From: Igor Mammedov Date: Tue, 23 Jul 2013 18:23:00 +0200 Message-Id: <1374596592-7027-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1374596592-7027-1-git-send-email-imammedo@redhat.com> References: <1374596592-7027-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 04/16] qapi: make visit_type_size fallback to type_int List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: vasilis.liaskovitis@profitbricks.com, hutao@cn.fujitsu.com, pbonzini@redhat.com From: Vasilis Liaskovitis 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 --- qapi/qapi-visit-core.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 401ee6e..fcacaff 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -238,8 +238,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; + } } } -- 1.7.1