From patchwork Tue Dec 18 12:41:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 207128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B796C2C0089 for ; Wed, 19 Dec 2012 01:07:58 +1100 (EST) Received: from localhost ([::1]:56229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwVe-0000HI-Tk for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2012 07:42:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwV2-0007Pq-0a for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkwV0-0008QG-HH for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:19 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:48473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwV0-0008Py-9m for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:18 -0500 Received: by mail-bk0-f46.google.com with SMTP id q16so291362bkw.33 for ; Tue, 18 Dec 2012 04:42:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=7NbVapQBPKnSKuKkrtPabeZKMAAkXT9KlMKJeNAf1FU=; b=FuFx6ttDVCMm8WjmPD/jBYZN6Poak3e/eZDPnITlCGx78Yfvetc6PD19eledQWfOeZ Wez3/Y8Ccixh6E679GFYvfhHxt1M8GaYfKioTw1KuqM66LYeQXmWWZ9+8rUblXjjlmV8 ndqVLP5n+A7wvXgim/Gd5AuI7Q9xWZWQuxe/rlDOLCKIigF4A23TScov87+/4M+HWYTC qhS3c7Qcv2yvjD8ZQp7Co6bqHKod3WAoNhUpxBjPRI6nf5b/rAGicfZtLU3p0F4jKBAe +RwHIkv0omN0jfqScpW4f8i2IAcxCsaN96Yg0Mw3nrF4Y2x52RjFYemAEnmIc8ZIJFHz 3Fbw== X-Received: by 10.204.151.7 with SMTP id a7mr693993bkw.8.1355834537216; Tue, 18 Dec 2012 04:42:17 -0800 (PST) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id f24sm1169954bkv.7.2012.12.18.04.42.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Dec 2012 04:42:16 -0800 (PST) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, seabios@seabios.org Date: Tue, 18 Dec 2012 13:41:34 +0100 Message-Id: <1355834518-17989-7-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1355834518-17989-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1355834518-17989-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQnhAijQp5L/Dyy/B2Bhi/N8rhieDx0p9oqoEbVb1zc4qIFyh2zfd2a3VmGqaFjU0E+EFXst X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.214.46 Cc: Vasilis Liaskovitis , pingfank@linux.vnet.ibm.com, gleb@redhat.com, stefanha@gmail.com, jbaron@redhat.com, blauwirbel@gmail.com, kevin@koconnor.net, kraxel@redhat.com, anthony@codemonkey.ws Subject: [Qemu-devel] [RFC PATCH v4 06/30] qapi: make visit_type_size fallback to type_int X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 7a82b63..497e693 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -236,8 +236,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; + } } }