From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: afaerber@suse.de, mst@redhat.com
Subject: [Qemu-devel] [PATCH 5/7] qapi: make visit_type_size fallback to type_int
Date: Mon, 29 Jul 2013 16:47:55 +0200 [thread overview]
Message-ID: <1375109277-25561-6-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1375109277-25561-1-git-send-email-imammedo@redhat.com>
From: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
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 <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
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
next prev parent reply other threads:[~2013-07-29 14:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-29 14:47 [Qemu-devel] [PATCH for-1.6 v3 0/7] pc: limit 64 bit hole to 2G by default Igor Mammedov
2013-07-29 14:47 ` [Qemu-devel] [PATCH 1/7] pc: move IO_APIC_DEFAULT_ADDRESS to include/hw/i386/ioapic.h Igor Mammedov
2013-07-29 14:47 ` [Qemu-devel] [PATCH 2/7] pc: add I440FX QOM cast macro Igor Mammedov
2013-07-29 14:47 ` [Qemu-devel] [PATCH 3/7] pc: replace i440fx_common_init() with i440fx_init() Igor Mammedov
2013-07-29 14:47 ` [Qemu-devel] [PATCH 4/7] pc: add Q35 to QOM composition tree under /machine Igor Mammedov
2013-07-29 14:47 ` Igor Mammedov [this message]
2013-07-29 14:47 ` [Qemu-devel] [PATCH 6/7] qdev: Add SIZE type to qdev properties Igor Mammedov
2013-07-29 14:47 ` [Qemu-devel] [PATCH 7/7] pc: limit 64 bit hole to 2G by default Igor Mammedov
2013-07-29 18:05 ` Michael S. Tsirkin
2013-08-02 17:31 ` Andreas Färber
2013-07-29 18:06 ` [Qemu-devel] [PATCH for-1.6 v3 0/7] " Michael S. Tsirkin
2013-08-02 12:35 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375109277-25561-6-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).