[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/22] qapi: add core QMP server support
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 10/22] qapi: add core QMP server support |
Date: |
Mon, 7 Mar 2011 13:09:21 +0000 |
On Mon, Mar 7, 2011 at 1:22 AM, Anthony Liguori <address@hidden> wrote:
> +char *qobject_as_string(QObject *obj)
> +{
> + char buffer[1024];
> +
> + switch (qobject_type(obj)) {
> + case QTYPE_QINT:
> + snprintf(buffer, sizeof(buffer), "%" PRId64,
> + qint_get_int(qobject_to_qint(obj)));
> + return qemu_strdup(buffer);
> + case QTYPE_QSTRING:
> + return qemu_strdup(qstring_get_str(qobject_to_qstring(obj)));
> + case QTYPE_QFLOAT:
> + snprintf(buffer, sizeof(buffer), "%.17g",
> + qfloat_get_double(qobject_to_qfloat(obj)));
> + return qemu_strdup(buffer);
qemu_asprintf() would be a nice helper function to have ;).
Stefan
[Qemu-devel] [PATCH 12/22] qapi: add QAPI module type, Anthony Liguori, 2011/03/06
[Qemu-devel] [PATCH 06/22] qapi: add JSON parsing error message, Anthony Liguori, 2011/03/06
[Qemu-devel] [PATCH 13/22] qapi: add code generators for QMP command marshaling, Anthony Liguori, 2011/03/06
[Qemu-devel] [PATCH 15/22] qapi: add new QMP server that uses CharDriverState, Anthony Liguori, 2011/03/06