[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 05/22] qdict: Remove delete from qdict_flatten_qd
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v5 05/22] qdict: Remove delete from qdict_flatten_qdict() |
Date: |
Fri, 13 Dec 2013 18:10:16 +0100 |
delete is always set to true, therefore it can be removed.
Signed-off-by: Max Reitz <address@hidden>
---
qobject/qdict.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 1d0e66c..ec42b1c 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -520,18 +520,15 @@ static void qdict_flatten_qlist(QList *qlist, QDict
*target, const char *prefix)
static void qdict_flatten_qdict(QDict *qdict, QDict *target, const char
*prefix)
{
QObject *value;
- const QDictEntry *entry, *next;
+ const QDictEntry *entry;
char *new_key;
- bool delete;
entry = qdict_first(qdict);
while (entry != NULL) {
- next = qdict_next(qdict, entry);
value = qdict_entry_value(entry);
new_key = NULL;
- delete = false;
if (prefix) {
new_key = g_strdup_printf("%s.%s", prefix, entry->key);
@@ -542,29 +539,21 @@ static void qdict_flatten_qdict(QDict *qdict, QDict
*target, const char *prefix)
* itself disappears. */
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,
new_key ? new_key : entry->key);
- delete = true;
} else if (prefix) {
/* All other objects are moved to the target unchanged. */
qobject_incref(value);
qdict_put_obj(target, new_key, value);
- delete = true;
}
g_free(new_key);
- if (delete) {
- qdict_del(qdict, entry->key);
-
- /* Restart loop after modifying the iterated QDict */
- entry = qdict_first(qdict);
- continue;
- }
+ qdict_del(qdict, entry->key);
- entry = next;
+ /* Restart loop after modifying the iterated QDict */
+ entry = qdict_first(qdict);
}
}
--
1.8.5.1
- Re: [Qemu-devel] [PATCH v3 21/21] iotests: Test new blkdebug/blkverify interface, (continued)
- Re: [Qemu-devel] [PATCH v3 00/21] blkdebug/blkverify: Allow QMP configuration, Fam Zheng, 2013/12/12
- [Qemu-devel] [PATCH v3 00/21] blkdebug/blkverify: Allow QMP configuration, Max Reitz, 2013/12/13
- [Qemu-devel] [PATCH v5 06/22] qemu-option: Add qemu_config_parse_qdict(), Max Reitz, 2013/12/13
- [Qemu-devel] [PATCH v5 04/22] qapi: extend qdict_flatten() for QLists, Max Reitz, 2013/12/13
- [Qemu-devel] [PATCH v5 07/22] blkdebug: Always call read_config(), Max Reitz, 2013/12/13
- [Qemu-devel] [PATCH v5 08/22] blkdebug: Use command-line in read_config(), Max Reitz, 2013/12/13