qobject: Rename qtype_code to QType
authorEric Blake <eblake@redhat.com>
Wed, 2 Dec 2015 05:20:46 +0000 (22:20 -0700)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 17 Dec 2015 07:21:28 +0000 (08:21 +0100)
The name QType matches our CODING_STYLE conventions for type names
in CamelCase.  It also matches the fact that we are already naming
all the enum members with a prefix of QTYPE, not QTYPE_CODE.  And
doing the rename will also make it easier for the next patch to use
QAPI for providing the enum, which also wants CamelCase type names.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-3-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
block/qapi.c
include/hw/qdev-core.h
include/qapi/qmp/qobject.h
qobject/qdict.c
scripts/qapi.py

index 267f147fe3ddb4187dd97b908e460cb5c9844cbf..c0e877e07e646d90258e8f5209a5bc719f0003e7 100644 (file)
@@ -588,7 +588,7 @@ static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
     int i = 0;
 
     for (entry = qlist_first(list); entry; entry = qlist_next(entry), i++) {
-        qtype_code type = qobject_type(entry->value);
+        QType type = qobject_type(entry->value);
         bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
         const char *format = composite ? "%*s[%i]:\n" : "%*s[%i]: ";
 
@@ -606,7 +606,7 @@ static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
     const QDictEntry *entry;
 
     for (entry = qdict_first(dict); entry; entry = qdict_next(dict, entry)) {
-        qtype_code type = qobject_type(entry->value);
+        QType type = qobject_type(entry->value);
         bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
         const char *format = composite ? "%*s%s:\n" : "%*s%s: ";
         char key[strlen(entry->key) + 1];
index c537969f4eed5ab789784010f9f8fee5f79b8699..abcdee852b8dd57a255dc0de43f0c9f85ed63e2a 100644 (file)
@@ -239,7 +239,7 @@ struct Property {
     PropertyInfo *info;
     ptrdiff_t    offset;
     uint8_t      bitnr;
-    qtype_code   qtype;
+    QType        qtype;
     int64_t      defval;
     int          arrayoffset;
     PropertyInfo *arrayinfo;
index 550ba40ddecc26fd894895e6e984e660eff15cd1..c0f1e99bca16570bf1e724139eb8f23823d2048f 100644 (file)
@@ -45,10 +45,10 @@ typedef enum {
     QTYPE_QFLOAT,
     QTYPE_QBOOL,
     QTYPE_MAX,
-} qtype_code;
+} QType;
 
 typedef struct QObject {
-    qtype_code type;
+    QType type;
     size_t refcnt;
 } QObject;
 
@@ -64,7 +64,7 @@ typedef struct QObject {
     qobject_decref(obj ? QOBJECT(obj) : NULL)
 
 /* Initialize an object to default values */
-static inline void qobject_init(QObject *obj, qtype_code type)
+static inline void qobject_init(QObject *obj, QType type)
 {
     assert(QTYPE_NONE < type && type < QTYPE_MAX);
     obj->refcnt = 1;
@@ -100,7 +100,7 @@ static inline void qobject_decref(QObject *obj)
 /**
  * qobject_type(): Return the QObject's type
  */
-static inline qtype_code qobject_type(const QObject *obj)
+static inline QType qobject_type(const QObject *obj)
 {
     assert(QTYPE_NONE < obj->type && obj->type < QTYPE_MAX);
     return obj->type;
index eeade159ccfb89796486180d002640558d7b6211..19df837c552d0cc668a5f0e51af1907b9896a432 100644 (file)
@@ -177,8 +177,7 @@ size_t qdict_size(const QDict *qdict)
 /**
  * qdict_get_obj(): Get a QObject of a specific type
  */
-static QObject *qdict_get_obj(const QDict *qdict, const char *key,
-                              qtype_code type)
+static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type)
 {
     QObject *obj;
 
index 10fcfbc8d26fc00d79b2a129fe724b99f7b21e2d..b336fbd57cb51f251cfd7f8acab51c3a800300ed 100644 (file)
@@ -33,7 +33,7 @@ builtin_types = {
     'uint32':   'QTYPE_QINT',
     'uint64':   'QTYPE_QINT',
     'size':     'QTYPE_QINT',
-    'any':      None,           # any qtype_code possible, actually
+    'any':      None,           # any QType possible, actually
 }
 
 # Whitelist of commands allowed to return a non-dictionary