diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2021-01-28 22:43:18 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2021-01-28 22:43:18 +0000 |
| commit | 7e7eb9f852a46b51a71ae9d82590b2e4d28827ee (patch) | |
| tree | d63017ecda357d29659abe087aa6a09d808b06b5 /job-qmp.c | |
| parent | 0bcd12fb1513bad44f05f2d3a8eef2a99b3077b6 (diff) | |
| parent | 95b3a8c8a82a34ca874ac0d4a9bbbdb38034acf3 (diff) | |
| download | focaccia-qemu-7e7eb9f852a46b51a71ae9d82590b2e4d28827ee.tar.gz focaccia-qemu-7e7eb9f852a46b51a71ae9d82590b2e4d28827ee.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-01-28' into staging
QAPI patches patches for 2021-01-28 # gpg: Signature made Thu 28 Jan 2021 07:10:21 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2021-01-28: qapi: More complex uses of QAPI_LIST_APPEND qapi: Use QAPI_LIST_APPEND in trivial cases qapi: Introduce QAPI_LIST_APPEND qapi: A couple more QAPI_LIST_PREPEND() stragglers net: Clarify early exit condition Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'job-qmp.c')
| -rw-r--r-- | job-qmp.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/job-qmp.c b/job-qmp.c index 645601b2cc..34c4da094f 100644 --- a/job-qmp.c +++ b/job-qmp.c @@ -164,28 +164,25 @@ static JobInfo *job_query_single(Job *job, Error **errp) JobInfoList *qmp_query_jobs(Error **errp) { - JobInfoList *head = NULL, **p_next = &head; + JobInfoList *head = NULL, **tail = &head; Job *job; for (job = job_next(NULL); job; job = job_next(job)) { - JobInfoList *elem; + JobInfo *value; AioContext *aio_context; if (job_is_internal(job)) { continue; } - elem = g_new0(JobInfoList, 1); aio_context = job->aio_context; aio_context_acquire(aio_context); - elem->value = job_query_single(job, errp); + value = job_query_single(job, errp); aio_context_release(aio_context); - if (!elem->value) { - g_free(elem); + if (!value) { qapi_free_JobInfoList(head); return NULL; } - *p_next = elem; - p_next = &elem->next; + QAPI_LIST_APPEND(tail, value); } return head; |