diff options
author | Eric Blake <eblake@redhat.com> | 2021-01-13 16:10:12 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-01-28 08:08:45 +0100 |
commit | c3033fd372fdaf5b89190136a74b3d78880b85d6 (patch) | |
tree | 6c2464ae3f51b43702c448606acb3a6c21b6b634 /monitor/hmp-cmds.c | |
parent | dc13f40c6ba291e31d09053815c230ed88c8921f (diff) |
qapi: Use QAPI_LIST_APPEND in trivial cases
The easiest spots to use QAPI_LIST_APPEND are where we already have an
obvious pointer to the tail of a list. While at it, consistently use
the variable name 'tail' for that purpose.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210113221013.390592-5-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor/hmp-cmds.c')
-rw-r--r-- | monitor/hmp-cmds.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 499647a578..529f18099e 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -76,20 +76,20 @@ void hmp_handle_error(Monitor *mon, Error *err) static strList *strList_from_comma_list(const char *in) { strList *res = NULL; - strList **hook = &res; + strList **tail = &res; while (in && in[0]) { char *comma = strchr(in, ','); - *hook = g_new0(strList, 1); + char *value; if (comma) { - (*hook)->value = g_strndup(in, comma - in); + value = g_strndup(in, comma - in); in = comma + 1; /* skip the , */ } else { - (*hook)->value = g_strdup(in); + value = g_strdup(in); in = NULL; } - hook = &(*hook)->next; + QAPI_LIST_APPEND(tail, value); } return res; |