summaryrefslogtreecommitdiff
path: root/qobject/qdict.c
diff options
context:
space:
mode:
Diffstat (limited to 'qobject/qdict.c')
-rw-r--r--qobject/qdict.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 229b8c840b..1e588123d0 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -206,7 +206,7 @@ size_t qdict_size(const QDict *qdict)
*/
double qdict_get_double(const QDict *qdict, const char *key)
{
- return qnum_get_double(qobject_to_qnum(qdict_get(qdict, key)));
+ return qnum_get_double(qobject_to(QNum, qdict_get(qdict, key)));
}
/**
@@ -219,7 +219,7 @@ double qdict_get_double(const QDict *qdict, const char *key)
*/
int64_t qdict_get_int(const QDict *qdict, const char *key)
{
- return qnum_get_int(qobject_to_qnum(qdict_get(qdict, key)));
+ return qnum_get_int(qobject_to(QNum, qdict_get(qdict, key)));
}
/**
@@ -232,7 +232,7 @@ int64_t qdict_get_int(const QDict *qdict, const char *key)
*/
bool qdict_get_bool(const QDict *qdict, const char *key)
{
- return qbool_get_bool(qobject_to_qbool(qdict_get(qdict, key)));
+ return qbool_get_bool(qobject_to(QBool, qdict_get(qdict, key)));
}
/**
@@ -240,7 +240,7 @@ bool qdict_get_bool(const QDict *qdict, const char *key)
*/
QList *qdict_get_qlist(const QDict *qdict, const char *key)
{
- return qobject_to_qlist(qdict_get(qdict, key));
+ return qobject_to(QList, qdict_get(qdict, key));
}
/**
@@ -248,7 +248,7 @@ QList *qdict_get_qlist(const QDict *qdict, const char *key)
*/
QDict *qdict_get_qdict(const QDict *qdict, const char *key)
{
- return qobject_to_qdict(qdict_get(qdict, key));
+ return qobject_to(QDict, qdict_get(qdict, key));
}
/**
@@ -262,7 +262,7 @@ QDict *qdict_get_qdict(const QDict *qdict, const char *key)
*/
const char *qdict_get_str(const QDict *qdict, const char *key)
{
- return qstring_get_str(qobject_to_qstring(qdict_get(qdict, key)));
+ return qstring_get_str(qobject_to(QString, qdict_get(qdict, key)));
}
/**
@@ -275,7 +275,7 @@ const char *qdict_get_str(const QDict *qdict, const char *key)
int64_t qdict_get_try_int(const QDict *qdict, const char *key,
int64_t def_value)
{
- QNum *qnum = qobject_to_qnum(qdict_get(qdict, key));
+ QNum *qnum = qobject_to(QNum, qdict_get(qdict, key));
int64_t val;
if (!qnum || !qnum_get_try_int(qnum, &val)) {
@@ -294,7 +294,7 @@ int64_t qdict_get_try_int(const QDict *qdict, const char *key,
*/
bool qdict_get_try_bool(const QDict *qdict, const char *key, bool def_value)
{
- QBool *qbool = qobject_to_qbool(qdict_get(qdict, key));
+ QBool *qbool = qobject_to(QBool, qdict_get(qdict, key));
return qbool ? qbool_get_bool(qbool) : def_value;
}
@@ -309,7 +309,7 @@ bool qdict_get_try_bool(const QDict *qdict, const char *key, bool def_value)
*/
const char *qdict_get_try_str(const QDict *qdict, const char *key)
{
- QString *qstr = qobject_to_qstring(qdict_get(qdict, key));
+ QString *qstr = qobject_to(QString, qdict_get(qdict, key));
return qstr ? qstring_get_str(qstr) : NULL;
}
@@ -432,8 +432,8 @@ void qdict_del(QDict *qdict, const char *key)
*/
bool qdict_is_equal(const QObject *x, const QObject *y)
{
- const QDict *dict_x = qobject_to_qdict(x);
- const QDict *dict_y = qobject_to_qdict(y);
+ const QDict *dict_x = qobject_to(QDict, x);
+ const QDict *dict_y = qobject_to(QDict, y);
const QDictEntry *e;
if (qdict_size(dict_x) != qdict_size(dict_y)) {
@@ -461,7 +461,7 @@ void qdict_destroy_obj(QObject *obj)
QDict *qdict;
assert(obj != NULL);
- qdict = qobject_to_qdict(obj);
+ qdict = qobject_to(QDict, obj);
for (i = 0; i < QDICT_BUCKET_MAX; i++) {
QDictEntry *entry = QLIST_FIRST(&qdict->table[i]);
@@ -532,9 +532,9 @@ static void qdict_flatten_qlist(QList *qlist, QDict *target, const char *prefix)
new_key = g_strdup_printf("%s.%i", prefix, i);
if (qobject_type(value) == QTYPE_QDICT) {
- qdict_flatten_qdict(qobject_to_qdict(value), target, new_key);
+ qdict_flatten_qdict(qobject_to(QDict, value), target, new_key);
} else if (qobject_type(value) == QTYPE_QLIST) {
- qdict_flatten_qlist(qobject_to_qlist(value), target, new_key);
+ qdict_flatten_qlist(qobject_to(QList, value), target, new_key);
} else {
/* All other types are moved to the target unchanged. */
qobject_incref(value);
@@ -568,11 +568,11 @@ static void qdict_flatten_qdict(QDict *qdict, QDict *target, const char *prefix)
if (qobject_type(value) == QTYPE_QDICT) {
/* Entries of QDicts are processed recursively, the QDict object
* itself disappears. */
- qdict_flatten_qdict(qobject_to_qdict(value), target,
+ qdict_flatten_qdict(qobject_to(QDict, value), target,
new_key ? new_key : entry->key);
delete = true;
} else if (qobject_type(value) == QTYPE_QLIST) {
- qdict_flatten_qlist(qobject_to_qlist(value), target,
+ qdict_flatten_qlist(qobject_to(QList, value), target,
new_key ? new_key : entry->key);
delete = true;
} else if (prefix) {
@@ -904,7 +904,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
qdict_put_obj(two_level, prefix, child);
}
qobject_incref(ent->value);
- qdict_put_obj(qobject_to_qdict(child), suffix, ent->value);
+ qdict_put_obj(qobject_to(QDict, child), suffix, ent->value);
} else {
if (child) {
error_setg(errp, "Key %s prefix is already set as a dict",
@@ -926,7 +926,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
ent = qdict_next(two_level, ent)) {
if (qobject_type(ent->value) == QTYPE_QDICT) {
- child = qdict_crumple(qobject_to_qdict(ent->value), errp);
+ child = qdict_crumple(qobject_to(QDict, ent->value), errp);
if (!child) {
goto error;
}
@@ -961,7 +961,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
}
qobject_incref(child);
- qlist_append_obj(qobject_to_qlist(dst), child);
+ qlist_append_obj(qobject_to(QList, dst), child);
}
QDECREF(multi_level);
multi_level = NULL;