diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2021-01-01 14:33:03 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2021-01-01 14:33:03 +0000 |
| commit | 1f7c02797fa189ce4b34382020bbce63262a5758 (patch) | |
| tree | 467ab5404de2084c44df0f9d97b8524fa210c789 /qga/commands-win32.c | |
| parent | 50536341b47f1e6478c42d4b4a1337b72762721b (diff) | |
| parent | 4ac76ba414ecb94f086d73621775d8b38b6f0a43 (diff) | |
| download | focaccia-qemu-1f7c02797fa189ce4b34382020bbce63262a5758.tar.gz focaccia-qemu-1f7c02797fa189ce4b34382020bbce63262a5758.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-12-19' into staging
QAPI patches patches for 2020-12-19 # gpg: Signature made Sat 19 Dec 2020 09:40:05 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-2020-12-19: (33 commits) qobject: Make QString immutable block: Use GString instead of QString to build filenames keyval: Use GString to accumulate value strings json: Use GString instead of QString to accumulate strings migration: Replace migration's JSON writer by the general one qobject: Factor JSON writer out of qobject_to_json() qobject: Factor quoted_str() out of to_json() qobject: Drop qstring_get_try_str() qobject: Drop qobject_get_try_str() Revert "qobject: let object_property_get_str() use new API" block: Avoid qobject_get_try_str() qmp: Fix tracing of non-string command IDs qobject: Move internals to qobject-internal.h hw/rdma: Replace QList by GQueue Revert "qstring: add qstring_free()" qobject: Change qobject_to_json()'s value to GString qobject: Use GString instead of QString to accumulate JSON qobject: Make qobject_to_json_pretty() take a pretty argument monitor: Use GString instead of QString for output buffer hmp: Simplify how qmp_human_monitor_command() gets output ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qga/commands-win32.c')
| -rw-r--r-- | qga/commands-win32.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c index ba1fd07d06..684639bd13 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -874,7 +874,7 @@ err_close: static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) { Error *local_err = NULL; - GuestDiskAddressList *list = NULL, *cur_item = NULL; + GuestDiskAddressList *list = NULL; GuestDiskAddress *disk = NULL; int i; HANDLE vol_h; @@ -926,10 +926,8 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) error_free(local_err); goto out; } - list = g_malloc0(sizeof(*list)); - list->value = disk; + QAPI_LIST_PREPEND(list, disk); disk = NULL; - list->next = NULL; goto out; } else { error_setg_win32(errp, GetLastError(), @@ -960,11 +958,8 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) error_propagate(errp, local_err); goto out; } - cur_item = g_malloc0(sizeof(*list)); - cur_item->value = disk; + QAPI_LIST_PREPEND(list, disk); disk = NULL; - cur_item->next = list; - list = cur_item; } @@ -982,7 +977,7 @@ out: GuestDiskInfoList *qmp_guest_get_disks(Error **errp) { ERRP_GUARD(); - GuestDiskInfoList *new = NULL, *ret = NULL; + GuestDiskInfoList *ret = NULL; HDEVINFO dev_info; SP_DEVICE_INTERFACE_DATA dev_iface_data; int i; @@ -1064,10 +1059,7 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp) disk->has_address = true; } - new = g_malloc0(sizeof(GuestDiskInfoList)); - new->value = disk; - new->next = ret; - ret = new; + QAPI_LIST_PREPEND(ret, disk); } SetupDiDestroyDeviceInfoList(dev_info); @@ -1165,7 +1157,7 @@ free: GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp) { HANDLE vol_h; - GuestFilesystemInfoList *new, *ret = NULL; + GuestFilesystemInfoList *ret = NULL; char guid[256]; vol_h = FindFirstVolume(guid, sizeof(guid)); @@ -1183,10 +1175,7 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp) error_free(local_err); continue; } - new = g_malloc(sizeof(*ret)); - new->value = info; - new->next = ret; - ret = new; + QAPI_LIST_PREPEND(ret, info); } while (FindNextVolume(vol_h, guid, sizeof(guid))); if (GetLastError() != ERROR_NO_MORE_FILES) { @@ -1330,7 +1319,6 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) do { GuestFilesystemTrimResult *res; - GuestFilesystemTrimResultList *list; PWCHAR uc_path; DWORD char_count = 0; char *path, *out; @@ -1369,11 +1357,7 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) res->path = path; - list = g_new0(GuestFilesystemTrimResultList, 1); - list->value = res; - list->next = resp->paths; - - resp->paths = list; + QAPI_LIST_PREPEND(resp->paths, res); memset(argv, 0, sizeof(argv)); argv[0] = (gchar *)"defrag.exe"; |