mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-03-04 09:04:39 -07:00
QDict: Fix size update
Key replacement should not update the dictionary's size. This commit also adds a test for the bug. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
18dd19a7d9
commit
29ec3156ee
2 changed files with 3 additions and 2 deletions
|
|
@ -205,6 +205,8 @@ START_TEST(qdict_put_exists_test)
|
|||
|
||||
value = qdict_get_int(tests_dict, key);
|
||||
fail_unless(value == 2);
|
||||
|
||||
fail_unless(qdict_size(tests_dict) == 1);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
|||
3
qdict.c
3
qdict.c
|
|
@ -122,9 +122,8 @@ void qdict_put_obj(QDict *qdict, const char *key, QObject *value)
|
|||
/* allocate a new entry */
|
||||
entry = alloc_entry(key, value);
|
||||
QLIST_INSERT_HEAD(&qdict->table[hash], entry, next);
|
||||
qdict->size++;
|
||||
}
|
||||
|
||||
qdict->size++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue