Typedef the subtypes of QObject in qemu/typedefs.h, too

This renders many inclusions of qapi/qmp/q*.h superfluous. They'll be
dropped in the next few commits.

Backports commit 9f5c734d591e26186a71f9e36d752f4798df3672 from qemu
This commit is contained in:
Markus Armbruster 2018-03-07 12:29:30 -05:00 committed by Lioncash
parent 5d554fefeb
commit bbc9bcbb44
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
6 changed files with 15 additions and 10 deletions

View file

@ -17,10 +17,10 @@
#include "unicorn/platform.h" #include "unicorn/platform.h"
#include "qapi/qmp/qobject.h" #include "qapi/qmp/qobject.h"
typedef struct QBool { struct QBool {
QObject_HEAD; QObject_HEAD;
bool value; bool value;
} QBool; };
QBool *qbool_from_bool(bool value); QBool *qbool_from_bool(bool value);
bool qbool_get_bool(const QBool *qb); bool qbool_get_bool(const QBool *qb);

View file

@ -27,11 +27,11 @@ typedef struct QDictEntry {
QLIST_ENTRY(QDictEntry) next; QLIST_ENTRY(QDictEntry) next;
} QDictEntry; } QDictEntry;
typedef struct QDict { struct QDict {
QObject_HEAD; QObject_HEAD;
size_t size; size_t size;
QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX]; QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX];
} QDict; };
/* Object API */ /* Object API */
QDict *qdict_new(void); QDict *qdict_new(void);

View file

@ -22,10 +22,10 @@ typedef struct QListEntry {
QTAILQ_ENTRY(QListEntry) next; QTAILQ_ENTRY(QListEntry) next;
} QListEntry; } QListEntry;
typedef struct QList { struct QList {
QObject_HEAD; QObject_HEAD;
QTAILQ_HEAD(,QListEntry) head; QTAILQ_HEAD(,QListEntry) head;
} QList; };
#define qlist_append(qlist, obj) \ #define qlist_append(qlist, obj) \
qlist_append_obj(qlist, QOBJECT(obj)) qlist_append_obj(qlist, QOBJECT(obj))

View file

@ -23,7 +23,7 @@ typedef enum {
QNUM_DOUBLE QNUM_DOUBLE
} QNumKind; } QNumKind;
typedef struct QNum { struct QNum {
QObject base; QObject base;
QNumKind kind; QNumKind kind;
union { union {
@ -31,7 +31,7 @@ typedef struct QNum {
uint64_t u64; uint64_t u64;
double dbl; double dbl;
} u; } u;
} QNum; };
QNum *qnum_from_int(int64_t value); QNum *qnum_from_int(int64_t value);
QNum *qnum_from_uint(uint64_t value); QNum *qnum_from_uint(uint64_t value);

View file

@ -16,12 +16,12 @@
#include "unicorn/platform.h" #include "unicorn/platform.h"
#include "qapi/qmp/qobject.h" #include "qapi/qmp/qobject.h"
typedef struct QString { struct QString {
QObject_HEAD; QObject_HEAD;
char *string; char *string;
size_t length; size_t length;
size_t capacity; size_t capacity;
} QString; };
QString *qstring_new(void); QString *qstring_new(void);
QString *qstring_from_str(const char *str); QString *qstring_from_str(const char *str);

View file

@ -69,7 +69,12 @@ typedef struct QEMUSizedBuffer QEMUSizedBuffer;
typedef struct QEMUTimer QEMUTimer; typedef struct QEMUTimer QEMUTimer;
typedef struct QEMUTimerListGroup QEMUTimerListGroup; typedef struct QEMUTimerListGroup QEMUTimerListGroup;
typedef struct QemuConsole QemuConsole; typedef struct QemuConsole QemuConsole;
typedef struct QBool QBool;
typedef struct QDict QDict;
typedef struct QList QList;
typedef struct QNum QNum;
typedef struct QObject QObject; typedef struct QObject QObject;
typedef struct QString QString;
typedef struct RAMBlock RAMBlock; typedef struct RAMBlock RAMBlock;
typedef struct Range Range; typedef struct Range Range;
typedef struct SHPCDevice SHPCDevice; typedef struct SHPCDevice SHPCDevice;