render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
fbe740
From 401d5f108c69a01fca8843868e12d102e75e8dd2 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <401d5f108c69a01fca8843868e12d102e75e8dd2@dist-git>
fbe740
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
fbe740
Date: Fri, 13 Mar 2020 13:08:06 +0100
fbe740
Subject: [PATCH] virbuftest: use field names when initalizing test info
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Allow adding new fields without changing all the macros.
fbe740
fbe740
Otherwise the compiler complains that not all have been initialized:
fbe740
../../tests/virbuftest.c:419:5: error: missing field 'arg' initializer [-Werror,-Wmissing-field-initializers]
fbe740
    DO_TEST_ESCAPE("",
fbe740
    ^
fbe740
../../tests/virbuftest.c:414:56: note: expanded from macro 'DO_TEST_ESCAPE'
fbe740
        struct testBufAddStrData info = { data, expect }; \
fbe740
fbe740
Signed-off-by: Ján Tomko <jtomko@redhat.com>
fbe740
Reviewed-by: Erik Skultety <eskultet@redhat.com>
fbe740
(cherry picked from commit 46afdc21207d3276f0e100b6e54ca41ee5f12e99)
fbe740
fbe740
Prerequisite for: https://bugzilla.redhat.com/show_bug.cgi?id=1808499
fbe740
fbe740
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
fbe740
Message-Id: <b5da3d53ae4fc1a592b41230f3b838357cc57d30.1584101247.git.mprivozn@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 tests/virbuftest.c | 12 ++++++------
fbe740
 1 file changed, 6 insertions(+), 6 deletions(-)
fbe740
fbe740
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
fbe740
index bb606c1c28..1780b62bf4 100644
fbe740
--- a/tests/virbuftest.c
fbe740
+++ b/tests/virbuftest.c
fbe740
@@ -372,9 +372,9 @@ mymain(void)
fbe740
     DO_TEST("set indent", testBufSetIndent);
fbe740
     DO_TEST("autoclean", testBufferAutoclean);
fbe740
 
fbe740
-#define DO_TEST_ADD_STR(DATA, EXPECT) \
fbe740
+#define DO_TEST_ADD_STR(_data, _expect) \
fbe740
     do { \
fbe740
-        struct testBufAddStrData info = { DATA, EXPECT }; \
fbe740
+        struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
fbe740
         if (virTestRun("Buf: AddStr", testBufAddStr, &info) < 0) \
fbe740
             ret = -1; \
fbe740
     } while (0)
fbe740
@@ -384,9 +384,9 @@ mymain(void)
fbe740
     DO_TEST_ADD_STR("\n", "<c>\n  \n</c>");
fbe740
     DO_TEST_ADD_STR("\n  \n\n", "<c>\n  \n    \n  \n</c>");
fbe740
 
fbe740
-#define DO_TEST_ESCAPE(data, expect) \
fbe740
+#define DO_TEST_ESCAPE(_data, _expect) \
fbe740
     do { \
fbe740
-        struct testBufAddStrData info = { data, expect }; \
fbe740
+        struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
fbe740
         if (virTestRun("Buf: EscapeStr", testBufEscapeStr, &info) < 0) \
fbe740
             ret = -1; \
fbe740
     } while (0)
fbe740
@@ -400,9 +400,9 @@ mymain(void)
fbe740
     DO_TEST_ESCAPE("\x01\x01\x02\x03\x05\x08",
fbe740
                    "<c>\n  <el></el>\n</c>");
fbe740
 
fbe740
-#define DO_TEST_ESCAPE_REGEX(data, expect) \
fbe740
+#define DO_TEST_ESCAPE_REGEX(_data, _expect) \
fbe740
     do { \
fbe740
-        struct testBufAddStrData info = { data, expect }; \
fbe740
+        struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
fbe740
         if (virTestRun("Buf: EscapeRegex", testBufEscapeRegex, &info) < 0) \
fbe740
             ret = -1; \
fbe740
     } while (0)
fbe740
-- 
fbe740
2.25.1
fbe740