diff options
Diffstat (limited to 'include/qapi')
-rw-r--r-- | include/qapi/qmp/qobject.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h index c0f1e99bca..74459ae14b 100644 --- a/include/qapi/qmp/qobject.h +++ b/include/qapi/qmp/qobject.h @@ -34,23 +34,12 @@ #include <stddef.h> #include <assert.h> +#include "qapi-types.h" -typedef enum { - QTYPE_NONE, /* sentinel value, no QObject has this type code */ - QTYPE_QNULL, - QTYPE_QINT, - QTYPE_QSTRING, - QTYPE_QDICT, - QTYPE_QLIST, - QTYPE_QFLOAT, - QTYPE_QBOOL, - QTYPE_MAX, -} QType; - -typedef struct QObject { +struct QObject { QType type; size_t refcnt; -} QObject; +}; /* Get the 'base' part of an object */ #define QOBJECT(obj) (&(obj)->base) @@ -66,7 +55,7 @@ typedef struct QObject { /* Initialize an object to default values */ static inline void qobject_init(QObject *obj, QType type) { - assert(QTYPE_NONE < type && type < QTYPE_MAX); + assert(QTYPE_NONE < type && type < QTYPE__MAX); obj->refcnt = 1; obj->type = type; } @@ -102,7 +91,7 @@ static inline void qobject_decref(QObject *obj) */ static inline QType qobject_type(const QObject *obj) { - assert(QTYPE_NONE < obj->type && obj->type < QTYPE_MAX); + assert(QTYPE_NONE < obj->type && obj->type < QTYPE__MAX); return obj->type; } |