From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] qdev/prop: make uint32 accept both hex and decimal.
Date: Mon, 13 Jul 2009 11:36:00 +0200 [thread overview]
Message-ID: <1247477765-17026-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1247477765-17026-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qdev-properties.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index b4f4f21..cf1ad22 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -12,8 +12,11 @@ static void *prop_ptr(DeviceState *dev, Property *prop)
static int parse_uint32(DeviceState *dev, Property *prop, const char *str)
{
uint32_t *ptr = prop_ptr(dev, prop);
+ const char *fmt;
- if (sscanf(str, "%" PRIu32, ptr) != 1)
+ /* accept both hex and decimal */
+ fmt = strncasecmp(str, "0x",2) == 0 ? "%" PRIx32 : "%" PRIu32;
+ if (sscanf(str, fmt, ptr) != 1)
return -1;
return 0;
}
--
1.6.2.5
next prev parent reply other threads:[~2009-07-13 9:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 9:35 [Qemu-devel] [PATCH 0/6] qdev: property fixups Gerd Hoffmann
2009-07-13 9:36 ` Gerd Hoffmann [this message]
2009-07-13 9:36 ` [Qemu-devel] [PATCH 2/6] qdev/prop: add 16bit integer type Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 3/6] qdev/prop: unstatic and rename prop_ptr() Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 4/6] qdev/prop: add property for target_phys_addr_t Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 5/6] qdev/prop: convert m48t59 Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 6/6] qdev/prop: convert tcx Gerd Hoffmann
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=1247477765-17026-2-git-send-email-kraxel@redhat.com \
--to=kraxel@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).