aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
authorCarlos L. Torres <carlos.torres@rackspace.com>2015-07-19 18:02:21 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2015-09-09 15:34:54 +0200
commitd4ba8cb0a17e7de54753ff1bdeee4428118bb9ab (patch)
treeb8349d598a4d5e120ad8fd7889aec00b2e3291b6 /qmp.c
parent3904e6bf042391abc749d717465022e96e276fc7 (diff)
qmp: Add example usage of strto*l() qemu wrapper
Signed-off-by: Carlos L. Torres <carlos.torres@rackspace.com> Message-Id: <11ac63e95d88551f1c2c9b1216b15d3cb8ba4468.1437346779.git.carlos.torres@rackspace.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/qmp.c b/qmp.c
index 403805a551..9623c802ab 100644
--- a/qmp.c
+++ b/qmp.c
@@ -49,14 +49,20 @@ VersionInfo *qmp_query_version(Error **errp)
{
VersionInfo *info = g_new0(VersionInfo, 1);
const char *version = QEMU_VERSION;
- char *tmp;
+ const char *tmp;
+ int err;
info->qemu = g_new0(VersionTriple, 1);
- info->qemu->major = strtol(version, &tmp, 10);
+ err = qemu_strtoll(version, &tmp, 10, &info->qemu->major);
+ assert(err == 0);
tmp++;
- info->qemu->minor = strtol(tmp, &tmp, 10);
+
+ err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->minor);
+ assert(err == 0);
tmp++;
- info->qemu->micro = strtol(tmp, &tmp, 10);
+
+ err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->micro);
+ assert(err == 0);
info->package = g_strdup(QEMU_PKGVERSION);
return info;