提交 a7c31816 编写于 作者: M Markus Armbruster 提交者: Luiz Capitulino

qobject: Clean up around qtype_code

QTYPE_NONE is a sentinel value.  No QObject has this type code.
Document it properly.

Fix dump_qobject() to abort() on QTYPE_NONE, just like for any other
invalid type code.

Fix to_json() to abort() on all invalid type codes, not just
QTYPE_MAX.

Clean up Property member qtype's type: it's a qtype_code.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 4cf2d837
......@@ -523,9 +523,6 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
QDECREF(value);
break;
}
case QTYPE_NONE:
break;
case QTYPE_MAX:
default:
abort();
}
......
......@@ -226,7 +226,7 @@ struct Property {
PropertyInfo *info;
int offset;
uint8_t bitnr;
uint8_t qtype;
qtype_code qtype;
int64_t defval;
int arrayoffset;
PropertyInfo *arrayinfo;
......
......@@ -36,7 +36,7 @@
#include <assert.h>
typedef enum {
QTYPE_NONE,
QTYPE_NONE, /* sentinel value, no QObject has this type code */
QTYPE_QINT,
QTYPE_QSTRING,
QTYPE_QDICT,
......
......@@ -260,9 +260,8 @@ static void to_json(const QObject *obj, QString *str, int pretty, int indent)
}
case QTYPE_QERROR:
/* XXX: should QError be emitted? */
case QTYPE_NONE:
break;
case QTYPE_MAX:
default:
abort();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册