On 2018-02-21 14:53, Kevin Wolf wrote: > A few block drivers will need to rename .bdrv_create options for their > QAPIfication, so let's have a helper function for that. > > Signed-off-by: Kevin Wolf > --- > include/qapi/qmp/qdict.h | 6 +++ > qobject/qdict.c | 34 ++++++++++++++ > tests/check-qdict.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 153 insertions(+) [...] > diff --git a/tests/check-qdict.c b/tests/check-qdict.c > index ec628f3453..5f8f3be9ff 100644 > --- a/tests/check-qdict.c > +++ b/tests/check-qdict.c > @@ -665,6 +665,117 @@ static void qdict_crumple_test_empty(void) [...] > + /* Renames are processed top to bottom */ > + renames = (QDictRenames[]) { > + { "abc", "tmp" }, > + { "abcdef", "abc" }, > + { "number", "abcdef" }, > + { "flag", "number" }, > + { "nothing", "flag" }, > + { "tmp", "nothing" }, > + { NULL , NULL } > + }; A bit confusing to follow, but I guess nobody will have to follow it after me and Eric. > + copy = qdict_clone_shallow(dict); > + qdict_rename_keys(copy, renames, &error_abort); > + > + g_assert_cmpstr(qdict_get_str(copy, "nothing"), ==, "foo"); > + g_assert_cmpstr(qdict_get_str(copy, "abc"), ==, "bar"); > + g_assert_cmpint(qdict_get_int(copy, "abcdef"), ==, 42); > + g_assert_cmpint(qdict_get_bool(copy, "number"), ==, true); > + g_assert(qobject_type(qdict_get(copy, "flag")) == QTYPE_QNULL); > + g_assert(!qdict_haskey(copy, "tmp")); > + > + QDECREF(copy); > + > + /* Conflicting renam */ *rename With that fixed: Reviewed-by: Max Reitz