[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/14] qlit: move qlit from check-qjson to qobje
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH 02/14] qlit: move qlit from check-qjson to qobject/ |
Date: |
Thu, 31 Aug 2017 21:06:34 -0300 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
On Thu, Aug 24, 2017 at 12:33:38PM +0200, Marc-André Lureau wrote:
> Fix code style issues while at it, to please check-patch.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> include/qapi/qmp/qlit.h | 49 +++++++++++++++++++++++++
> qobject/qlit.c | 89 +++++++++++++++++++++++++++++++++++++++++++++
> tests/check-qjson.c | 96
> +------------------------------------------------
> qobject/Makefile.objs | 2 +-
> 4 files changed, 140 insertions(+), 96 deletions(-)
> create mode 100644 include/qapi/qmp/qlit.h
> create mode 100644 qobject/qlit.c
>
> diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h
> new file mode 100644
> index 0000000000..4e2e760ef1
> --- /dev/null
> +++ b/include/qapi/qmp/qlit.h
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright IBM, Corp. 2009
> + * Copyright (c) 2013, 2015, 2017 Red Hat Inc.
> + *
> + * Authors:
> + * Anthony Liguori <address@hidden>
> + * Markus Armbruster <address@hidden>
> + * Marc-André Lureau <address@hidden>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.1 or
> later.
> + * See the COPYING.LIB file in the top-level directory.
> + *
> + */
> +#ifndef QLIT_H_
> +#define QLIT_H_
> +
> +#include "qapi-types.h"
> +#include "qobject.h"
> +
> +typedef struct LiteralQDictEntry LiteralQDictEntry;
> +typedef struct LiteralQObject LiteralQObject;
> +
> +struct LiteralQObject {
> + int type;
> + union {
> + int64_t qnum;
> + const char *qstr;
> + LiteralQDictEntry *qdict;
> + LiteralQObject *qlist;
> + } value;
> +};
> +
> +struct LiteralQDictEntry {
> + const char *key;
> + LiteralQObject value;
> +};
> +
> +#define QLIT_QNUM(val) \
> + (LiteralQObject){.type = QTYPE_QNUM, .value.qnum = (val)}
> +#define QLIT_QSTR(val) \
> + (LiteralQObject){.type = QTYPE_QSTRING, .value.qstr = (val)}
> +#define QLIT_QDICT(val) \
> + (LiteralQObject){.type = QTYPE_QDICT, .value.qdict = (val)}
> +#define QLIT_QLIST(val) \
> + (LiteralQObject){.type = QTYPE_QLIST, .value.qlist = (val)}
I'm still trying to understand why this exists. Doesn't this
provide exactly the same functionality as QObject?
> [...]
--
Eduardo