[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 7/7] tests/unit: simpler variable sequence for test-io-channel
From: |
Laurent Vivier |
Subject: |
[PULL 7/7] tests/unit: simpler variable sequence for test-io-channel |
Date: |
Sat, 5 Nov 2022 20:52:27 +0100 |
From: Alex Bennée <alex.bennee@linaro.org>
This avoids some compilers complaining about a potentially
un-initialised [src|dst]argv. In retrospect using GString was overkill
for what we are constructing.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20221103102329.2581508-1-alex.bennee@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
tests/unit/test-io-channel-command.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/tests/unit/test-io-channel-command.c
b/tests/unit/test-io-channel-command.c
index 43e29c8cfbf4..19f72eab961d 100644
--- a/tests/unit/test-io-channel-command.c
+++ b/tests/unit/test-io-channel-command.c
@@ -33,19 +33,13 @@ static void test_io_channel_command_fifo(bool async)
{
g_autofree gchar *tmpdir = g_dir_make_tmp("qemu-test-io-channel.XXXXXX",
NULL);
g_autofree gchar *fifo = g_strdup_printf("%s/%s", tmpdir, TEST_FIFO);
- g_autoptr(GString) srcargs = g_string_new(socat);
- g_autoptr(GString) dstargs = g_string_new(socat);
- g_auto(GStrv) srcargv;
- g_auto(GStrv) dstargv;
+ g_autofree gchar *srcargs = g_strdup_printf("%s - PIPE:%s,wronly", socat,
fifo);
+ g_autofree gchar *dstargs = g_strdup_printf("%s PIPE:%s,rdonly -", socat,
fifo);
+ g_auto(GStrv) srcargv = g_strsplit(srcargs, " ", -1);
+ g_auto(GStrv) dstargv = g_strsplit(dstargs, " ", -1);
QIOChannel *src, *dst;
QIOChannelTest *test;
- g_string_append_printf(srcargs, " - PIPE:%s,wronly", fifo);
- g_string_append_printf(dstargs, " PIPE:%s,rdonly -", fifo);
-
- srcargv = g_strsplit(srcargs->str, " ", -1);
- dstargv = g_strsplit(dstargs->str, " ", -1);
-
src = QIO_CHANNEL(qio_channel_command_new_spawn((const char **) srcargv,
O_WRONLY,
&error_abort));
--
2.37.3
- [PULL 0/7] Trivial branch for 7.2 patches, Laurent Vivier, 2022/11/05
- [PULL 4/7] target/m68k: Rename qregs.def -> qregs.h.inc, Laurent Vivier, 2022/11/05
- [PULL 1/7] qapi: virtio: Fix the introduced version, Laurent Vivier, 2022/11/05
- [PULL 7/7] tests/unit: simpler variable sequence for test-io-channel,
Laurent Vivier <=
- [PULL 3/7] xen/pt: fix syntax error that causes FTBFS in some configurations, Laurent Vivier, 2022/11/05
- [PULL 2/7] Fix some typos in documentation and comments, Laurent Vivier, 2022/11/05
- [PULL 6/7] target/tricore: Rename csfr.def -> csfr.h.inc, Laurent Vivier, 2022/11/05
- [PULL 5/7] target/s390x: Rename insn-data/format.def -> insn-data/format.h.inc, Laurent Vivier, 2022/11/05
- Re: [PULL 0/7] Trivial branch for 7.2 patches, Stefan Hajnoczi, 2022/11/07