render / rpms / libvirt

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