mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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 <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170427215821.19397-7-eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
a92c21591b
commit
46f5ac205a
34 changed files with 244 additions and 268 deletions
16
block/ssh.c
16
block/ssh.c
|
@ -227,24 +227,23 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
|
|||
}
|
||||
|
||||
if(uri->user && strcmp(uri->user, "") != 0) {
|
||||
qdict_put(options, "user", qstring_from_str(uri->user));
|
||||
qdict_put_str(options, "user", uri->user);
|
||||
}
|
||||
|
||||
qdict_put(options, "server.host", qstring_from_str(uri->server));
|
||||
qdict_put_str(options, "server.host", uri->server);
|
||||
|
||||
port_str = g_strdup_printf("%d", uri->port ?: 22);
|
||||
qdict_put(options, "server.port", qstring_from_str(port_str));
|
||||
qdict_put_str(options, "server.port", port_str);
|
||||
g_free(port_str);
|
||||
|
||||
qdict_put(options, "path", qstring_from_str(uri->path));
|
||||
qdict_put_str(options, "path", uri->path);
|
||||
|
||||
/* Pick out any query parameters that we understand, and ignore
|
||||
* the rest.
|
||||
*/
|
||||
for (i = 0; i < qp->n; ++i) {
|
||||
if (strcmp(qp->p[i].name, "host_key_check") == 0) {
|
||||
qdict_put(options, "host_key_check",
|
||||
qstring_from_str(qp->p[i].value));
|
||||
qdict_put_str(options, "host_key_check", qp->p[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,9 +573,8 @@ static bool ssh_process_legacy_socket_options(QDict *output_opts,
|
|||
}
|
||||
|
||||
if (host) {
|
||||
qdict_put(output_opts, "server.host", qstring_from_str(host));
|
||||
qdict_put(output_opts, "server.port",
|
||||
qstring_from_str(port ?: stringify(22)));
|
||||
qdict_put_str(output_opts, "server.host", host);
|
||||
qdict_put_str(output_opts, "server.port", port ?: stringify(22));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue