[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 7/9] tests/x86: replace snprint() by g_strdup_printf() in driv
From: |
Michael Labiuk |
Subject: |
[PATCH v5 7/9] tests/x86: replace snprint() by g_strdup_printf() in drive_del-test |
Date: |
Fri, 30 Sep 2022 01:35:45 +0300 |
Using g_autofree char* and g_strdup_printf(...) instead of ugly
snprintf on stack array.
Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com>
---
tests/qtest/drive_del-test.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index 44b9578801..106c613f4f 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -123,12 +123,10 @@ static const char *qvirtio_get_dev_type(void)
static void device_add(QTestState *qts)
{
- QDict *response;
- char driver[32];
- snprintf(driver, sizeof(driver), "virtio-blk-%s",
- qvirtio_get_dev_type());
-
- response = qtest_qmp(qts, "{'execute': 'device_add',"
+ g_autofree char *driver = g_strdup_printf("virtio-blk-%s",
+ qvirtio_get_dev_type());
+ QDict *response =
+ qtest_qmp(qts, "{'execute': 'device_add',"
" 'arguments': {"
" 'driver': %s,"
" 'drive': 'drive0',"
--
2.34.1
- [PATCH v5 0/9] Add 'q35' machine type to hotplug tests, Michael Labiuk, 2022/09/29
- [PATCH v5 9/9] tests/x86: Add 'q35' machine type to ivshmem-test, Michael Labiuk, 2022/09/29
- [PATCH v5 5/9] tests/x86: Add 'q35' machine type to hotplug hd-geo-test, Michael Labiuk, 2022/09/29
- [PATCH v5 3/9] tests/x86: Refactor hot unplug hd-geo-test, Michael Labiuk, 2022/09/29
- [PATCH v5 8/9] tests/x86: Add 'q35' machine type to drive_del-test, Michael Labiuk, 2022/09/29
- [PATCH v5 2/9] tests/x86: Add subtest with 'q35' machine type to device-plug-test, Michael Labiuk, 2022/09/29
- [PATCH v5 7/9] tests/x86: replace snprint() by g_strdup_printf() in drive_del-test,
Michael Labiuk <=
- [PATCH v5 6/9] tests/x86: Fix comment typo in drive_del-test, Michael Labiuk, 2022/09/29
- [PATCH v5 1/9] tests/x86: add helper qtest_qmp_device_del_send(), Michael Labiuk, 2022/09/29
- [PATCH v5 4/9] tests/x86: Add 'q35' machine type to override-tests in hd-geo-test, Michael Labiuk, 2022/09/29