From 46f5ac205a9dc5e2c24274c7df371509a286281f Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 27 Apr 2017 16:58:17 -0500 Subject: qobject: Use simpler QDict/QList scalar insertion macros We now have macros in place to make it less verbose to add a scalar to QDict and QList, so use them. Patch created mechanically via: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place then touched up manually to fix a couple of '?:' back to original spacing, as well as avoiding a long line in monitor.c. Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster Message-Id: <20170427215821.19397-7-eblake@redhat.com> Reviewed-by: Stefan Hajnoczi Reviewed-by: Alberto Garcia Signed-off-by: Markus Armbruster --- block/rbd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'block/rbd.c') diff --git a/block/rbd.c b/block/rbd.c index fbf30591d1..e551639e47 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -154,20 +154,20 @@ static void qemu_rbd_parse_filename(const char *filename, QDict *options, goto done; } qemu_rbd_unescape(found_str); - qdict_put(options, "pool", qstring_from_str(found_str)); + qdict_put_str(options, "pool", found_str); if (strchr(p, '@')) { found_str = qemu_rbd_next_tok(p, '@', &p); qemu_rbd_unescape(found_str); - qdict_put(options, "image", qstring_from_str(found_str)); + qdict_put_str(options, "image", found_str); found_str = qemu_rbd_next_tok(p, ':', &p); qemu_rbd_unescape(found_str); - qdict_put(options, "snapshot", qstring_from_str(found_str)); + qdict_put_str(options, "snapshot", found_str); } else { found_str = qemu_rbd_next_tok(p, ':', &p); qemu_rbd_unescape(found_str); - qdict_put(options, "image", qstring_from_str(found_str)); + qdict_put_str(options, "image", found_str); } if (!p) { goto done; @@ -189,9 +189,9 @@ static void qemu_rbd_parse_filename(const char *filename, QDict *options, qemu_rbd_unescape(value); if (!strcmp(name, "conf")) { - qdict_put(options, "conf", qstring_from_str(value)); + qdict_put_str(options, "conf", value); } else if (!strcmp(name, "id")) { - qdict_put(options, "user" , qstring_from_str(value)); + qdict_put_str(options, "user", value); } else { /* * We pass these internally to qemu_rbd_set_keypairs(), so @@ -204,8 +204,8 @@ static void qemu_rbd_parse_filename(const char *filename, QDict *options, if (!keypairs) { keypairs = qlist_new(); } - qlist_append(keypairs, qstring_from_str(name)); - qlist_append(keypairs, qstring_from_str(value)); + qlist_append_str(keypairs, name); + qlist_append_str(keypairs, value); } } -- cgit v1.2.1