[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 01/17] build-sys: define QEMU_VERSION_{MAJOR, MIN
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v4 01/17] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO} |
Date: |
Wed, 10 Aug 2016 22:02:19 +0400 |
From: Marc-André Lureau <address@hidden>
There are better chances to find what went wrong at build time than a
later assert in qmp_query_version
Signed-off-by: Marc-André Lureau <address@hidden>
---
qmp.c | 16 +++-------------
scripts/create_config | 6 ++++++
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/qmp.c b/qmp.c
index b6d531e..ebc3ff6 100644
--- a/qmp.c
+++ b/qmp.c
@@ -51,21 +51,11 @@ NameInfo *qmp_query_name(Error **errp)
VersionInfo *qmp_query_version(Error **errp)
{
VersionInfo *info = g_new0(VersionInfo, 1);
- const char *version = QEMU_VERSION;
- const char *tmp;
- int err;
info->qemu = g_new0(VersionTriple, 1);
- err = qemu_strtoll(version, &tmp, 10, &info->qemu->major);
- assert(err == 0);
- tmp++;
-
- err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->minor);
- assert(err == 0);
- tmp++;
-
- err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->micro);
- assert(err == 0);
+ info->qemu->major = QEMU_VERSION_MAJOR;
+ info->qemu->minor = QEMU_VERSION_MINOR;
+ info->qemu->micro = QEMU_VERSION_MICRO;
info->package = g_strdup(QEMU_PKGVERSION);
return info;
diff --git a/scripts/create_config b/scripts/create_config
index 1dd6a35..e6929dd 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -7,7 +7,13 @@ while read line; do
case $line in
VERSION=*) # configuration
version=${line#*=}
+ major=$(echo "$version" | cut -d. -f1)
+ minor=$(echo "$version" | cut -d. -f2)
+ micro=$(echo "$version" | cut -d. -f3)
echo "#define QEMU_VERSION \"$version\""
+ echo "#define QEMU_VERSION_MAJOR $major"
+ echo "#define QEMU_VERSION_MINOR $minor"
+ echo "#define QEMU_VERSION_MICRO $micro"
;;
qemu_*dir=*) # qemu-specific directory configuration
name=${line%=*}
--
2.9.0
- [Qemu-devel] [PATCH v4 00/17] qapi: remove the 'middle' mode, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 01/17] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO},
marcandre . lureau <=
- [Qemu-devel] [PATCH v4 02/17] qapi-schema: use generated marshaller for 'qmp_capabilities', marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 03/17] qapi-schema: add 'device_add', marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 04/17] monitor: simplify invalid_qmp_mode(), marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 05/17] monitor: register gen:false commands manually, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 06/17] monitor: unregister conditional commands, marcandre . lureau, 2016/08/10
- Re: [Qemu-devel] [PATCH v4 06/17] monitor: unregister conditional commands, Markus Armbruster, 2016/08/17