From: malc <av1474@comtv.ru>
To: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] QMP/monitor: update do_info_version() to output broken down version string
Date: Mon, 9 Aug 2010 22:09:36 +0400 (MSD) [thread overview]
Message-ID: <alpine.LNX.2.00.1008092209030.3478@linmac> (raw)
In-Reply-To: <1281373256-602-3-git-send-email-miguel.filho@gmail.com>
On Mon, 9 Aug 2010, Miguel Di Ciurcio Filho wrote:
> This code was originally developed by Daniel P. Berrange <berrange@redhat.com>
>
> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
> ---
> monitor.c | 23 +++++++++++++++++++----
> 1 files changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index c313d5a..e82c48f 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -669,17 +669,32 @@ help:
> static void do_info_version_print(Monitor *mon, const QObject *data)
> {
> QDict *qdict;
> + QDict *qemu;
>
> qdict = qobject_to_qdict(data);
> + qemu = qdict_get_qdict(qdict, "qemu");
>
> - monitor_printf(mon, "%s%s\n", qdict_get_str(qdict, "qemu"),
> - qdict_get_str(qdict, "package"));
> + monitor_printf(mon, "%" PRId64 ".%" PRId64 ".%" PRId64 "%s\n",
> + qdict_get_int(qemu, "major"),
> + qdict_get_int(qemu, "minor"),
> + qdict_get_int(qemu, "micro"),
> + qdict_get_str(qdict, "package"));
> }
Above snippet uses tab(s).
> static void do_info_version(Monitor *mon, QObject **ret_data)
> {
> - *ret_data = qobject_from_jsonf("{ 'qemu': %s, 'package': %s }",
> - QEMU_VERSION, QEMU_PKGVERSION);
> + const char *version = QEMU_VERSION;
> + int major = 0, minor = 0, micro = 0;
> + char *tmp;
> +
> + major = strtol(version, &tmp, 10);
> + tmp++;
> + minor = strtol(tmp, &tmp, 10);
> + tmp++;
> + micro = strtol(tmp, &tmp, 10);
> +
> + *ret_data = qobject_from_jsonf("{ 'qemu': { 'major': %d, 'minor': %d, \
> + 'micro': %d }, 'package': %s }", major, minor, micro, QEMU_PKGVERSION);
> }
>
> static void do_info_name_print(Monitor *mon, const QObject *data)
>
--
mailto:av1474@comtv.ru
next prev parent reply other threads:[~2010-08-09 18:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-09 17:00 [Qemu-devel] [PATCH 0/2] QMP: update 'query-version' Miguel Di Ciurcio Filho
2010-08-09 17:00 ` [Qemu-devel] [PATCH 1/2] QMP: update 'query-version' documentation Miguel Di Ciurcio Filho
2010-08-09 17:00 ` [Qemu-devel] [PATCH 2/2] QMP/monitor: update do_info_version() to output broken down version string Miguel Di Ciurcio Filho
2010-08-09 18:09 ` malc [this message]
2010-08-26 13:07 ` [Qemu-devel] Re: [PATCH 0/2] QMP: update 'query-version' Luiz Capitulino
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=alpine.LNX.2.00.1008092209030.3478@linmac \
--to=av1474@comtv.ru \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=miguel.filho@gmail.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).