aboutsummaryrefslogtreecommitdiff
path: root/qobject
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@amazon.com>2013-12-06 12:59:58 -0800
committerAnthony Liguori <aliguori@amazon.com>2013-12-06 12:59:58 -0800
commit0a0ee0b93bdd6e1ef628283d00bb979e27655ebb (patch)
treea8e1d34e3a187afc96d8697dfe121032a0268912 /qobject
parent9ed5dacbfa0f3f74238854776385f150b68e78b9 (diff)
parent981cbf59b5360647e908186e7306ee9013a58c88 (diff)
Merge remote-tracking branch 'kwolf/tags/for-anthony' into staging
Block patches for 2.0 (flushing block-next) # gpg: Signature made Fri 29 Nov 2013 08:43:18 AM PST using RSA key ID C88F2FD6 # gpg: Can't check signature: public key not found # By Peter Lieven (17) and others # Via Kevin Wolf * kwolf/tags/for-anthony: (41 commits) qemu-iotests: Add sample image and test for VMDK version 3 vmdk: Allow read only open of VMDK version 3 qemu-iotests: Filter out 'qemu-io> ' prompt qemu-iotests: Filter qemu-io output in 025 block: Use BDRV_O_NO_BACKING where appropriate qemu-iotests: Test snapshot mode block: Enable BDRV_O_SNAPSHOT with driver-specific options qemu-iotests: Make test case 030, 040 and 055 deterministic qemu-iotest: Add pause_drive and resume_drive methods blkdebug: add "remove_break" command qemu-iotests: Drop local version of cancel_and_wait from 040 sheepdog: support user-defined redundancy option sheepdog: refactor do_sd_create() qdict: Optimise qdict_do_flatten() qdict: Fix memory leak in qdict_do_flatten() MAINTAINERS: add sheepdog development mailing list COW: Extend checking allocated bits to beyond one sector COW: Speed up writes qapi: Change BlockDirtyInfo to list block: per caller dirty bitmap ... Message-id: 1385743555-27888-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
Diffstat (limited to 'qobject')
-rw-r--r--qobject/qdict.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 0f3e0a6c81..17e14f08b1 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -481,7 +481,7 @@ static void qdict_do_flatten(QDict *qdict, QDict *target, const char *prefix)
{
QObject *value;
const QDictEntry *entry, *next;
- const char *new_key;
+ char *new_key;
bool delete;
entry = qdict_first(qdict);
@@ -494,18 +494,24 @@ static void qdict_do_flatten(QDict *qdict, QDict *target, const char *prefix)
delete = false;
if (prefix) {
- qobject_incref(value);
new_key = g_strdup_printf("%s.%s", prefix, entry->key);
- qdict_put_obj(target, new_key, value);
- delete = true;
}
if (qobject_type(value) == QTYPE_QDICT) {
+ /* Entries of QDicts are processed recursively, the QDict object
+ * itself disappears. */
qdict_do_flatten(qobject_to_qdict(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);