tests/x86: replace snprint() by g_strdup_printf() in drive_del-test

Using g_autofree char* and  g_strdup_printf(...) instead of ugly
snprintf on stack array.

Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com>
Message-Id: <20220929223547.1429580-8-michael.labiuk@virtuozzo.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Michael Labiuk 2022-09-30 01:35:45 +03:00 committed by Thomas Huth
parent cb06b3d924
commit 5356d752ed

View File

@ -123,12 +123,10 @@ static const char *qvirtio_get_dev_type(void)
static void device_add(QTestState *qts) static void device_add(QTestState *qts)
{ {
QDict *response; g_autofree char *driver = g_strdup_printf("virtio-blk-%s",
char driver[32]; qvirtio_get_dev_type());
snprintf(driver, sizeof(driver), "virtio-blk-%s", QDict *response =
qvirtio_get_dev_type()); qtest_qmp(qts, "{'execute': 'device_add',"
response = qtest_qmp(qts, "{'execute': 'device_add',"
" 'arguments': {" " 'arguments': {"
" 'driver': %s," " 'driver': %s,"
" 'drive': 'drive0'," " 'drive': 'drive0',"