[PATCH 07/23] testutilsqemu: Create a typedef for struct testQemuInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The typedef will come in handy to create an autoptr cleaning function
later on.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c  | 14 +++++++-------
 tests/qemuxml2xmltest.c   | 12 ++++++------
 tests/qemuxmlactivetest.c |  6 +++---
 tests/testutilsqemu.c     |  6 +++---
 tests/testutilsqemu.h     | 10 ++++++----
 5 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index cb78465fc2..09ba2647ae 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -384,7 +384,7 @@ static virCommand *
 testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
                                virDomainObj *vm,
                                const char *migrateURI,
-                               struct testQemuInfo *info,
+                               testQemuInfo *info,
                                unsigned int flags)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -561,7 +561,7 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,

 static int
 testCompareXMLToArgvValidateSchema(virCommand *cmd,
-                                   struct testQemuInfo *info)
+                                   testQemuInfo *info)
 {
     g_auto(GStrv) args = NULL;

@@ -579,7 +579,7 @@ testCompareXMLToArgvValidateSchema(virCommand *cmd,


 static int
-testInfoCheckDuplicate(struct testQemuInfo *info)
+testInfoCheckDuplicate(testQemuInfo *info)
 {
     const char *path = info->outfile;

@@ -603,7 +603,7 @@ testInfoCheckDuplicate(struct testQemuInfo *info)
 static int
 testCompareXMLToArgv(const void *data)
 {
-    struct testQemuInfo *info = (void *) data;
+    testQemuInfo *info = (void *) data;
     g_autofree char *migrateURI = NULL;
     g_auto(virBuffer) actualBuf = VIR_BUFFER_INITIALIZER;
     g_autofree char *actualargv = NULL;
@@ -626,7 +626,7 @@ testCompareXMLToArgv(const void *data)
     /* mark test case as used */
     ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->infile));

-    if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
+    if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
         goto cleanup;

     if (testInfoCheckDuplicate(info) < 0)
@@ -812,7 +812,7 @@ testCompareXMLToArgv(const void *data)
 }

 static void
-testInfoSetPaths(struct testQemuInfo *info,
+testInfoSetPaths(testQemuInfo *info,
                  const char *suffix)
 {
     info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml",
@@ -941,7 +941,7 @@ mymain(void)
  */
 # define DO_TEST_FULL(_name, _suffix, ...) \
     do { \
-        static struct testQemuInfo info = { \
+        static testQemuInfo info = { \
             .name = _name, \
         }; \
         testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index a03a20752d..b4fcd87df8 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -20,9 +20,9 @@
 static virQEMUDriver driver;

 static int
-testXML2XMLCommon(const struct testQemuInfo *info)
+testXML2XMLCommon(const testQemuInfo *info)
 {
-    if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
+    if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
         return -1;

     virFileCacheClear(driver.qemuCapsCache);
@@ -37,7 +37,7 @@ testXML2XMLCommon(const struct testQemuInfo *info)
 static int
 testXML2XMLActive(const void *opaque)
 {
-    const struct testQemuInfo *info = opaque;
+    const testQemuInfo *info = opaque;

     if (info->flags & FLAG_SKIP_CONFIG_ACTIVE)
         return EXIT_AM_SKIP;
@@ -57,7 +57,7 @@ testXML2XMLActive(const void *opaque)
 static int
 testXML2XMLInactive(const void *opaque)
 {
-    const struct testQemuInfo *info = opaque;
+    const testQemuInfo *info = opaque;

     if (testXML2XMLCommon(info) < 0 ||
         testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
@@ -84,7 +84,7 @@ testXML2XMLInactive(const void *opaque)
  * both the "active" and "inactive" versions are the same.
  */
 static void
-testInfoSetPaths(struct testQemuInfo *info,
+testInfoSetPaths(testQemuInfo *info,
                  const char *suffix,
                  const char *statesuffix)
 {
@@ -148,7 +148,7 @@ mymain(void)

 #define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
     do { \
-        static struct testQemuInfo info = { \
+        static testQemuInfo info = { \
             .name = _name, \
         }; \
         testQemuInfoSetArgs(&info, &testConf, \
diff --git a/tests/qemuxmlactivetest.c b/tests/qemuxmlactivetest.c
index f60378c691..9224bd5d05 100644
--- a/tests/qemuxmlactivetest.c
+++ b/tests/qemuxmlactivetest.c
@@ -18,7 +18,7 @@ static virQEMUDriver driver;
 static int
 testCompareStatusXMLToXMLFiles(const void *opaque)
 {
-    const struct testQemuInfo *data = opaque;
+    const testQemuInfo *data = opaque;
     virDomainObj *obj = NULL;
     g_autofree char *actual = NULL;
     int ret = -1;
@@ -61,7 +61,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
 static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";

 static void
-testInfoSetStatusPaths(struct testQemuInfo *info)
+testInfoSetStatusPaths(testQemuInfo *info)
 {
     info->infile = g_strdup_printf("%s%s-in.xml", statusPath, info->name);
     info->outfile = g_strdup_printf("%s%s-out.xml", statusPath, info->name);
@@ -90,7 +90,7 @@ mymain(void)

 #define DO_TEST_STATUS(_name) \
     do { \
-        static struct testQemuInfo info = { \
+        static testQemuInfo info = { \
             .name = _name, \
         }; \
         testQemuInfoSetArgs(&info, &testConf, ARG_END); \
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 1e9512d478..cf4ef3a317 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -623,7 +623,7 @@ testQemuCapsIterate(const char *suffix,


 void
-testQemuInfoSetArgs(struct testQemuInfo *info,
+testQemuInfoSetArgs(testQemuInfo *info,
                     struct testQemuConf *conf, ...)
 {
     va_list argptr;
@@ -900,7 +900,7 @@ testQemuInsertRealCaps(virFileCache *cache,


 int
-testQemuInfoInitArgs(struct testQemuInfo *info)
+testQemuInfoInitArgs(testQemuInfo *info)
 {
     ssize_t cap;

@@ -959,7 +959,7 @@ testQemuInfoInitArgs(struct testQemuInfo *info)


 void
-testQemuInfoClear(struct testQemuInfo *info)
+testQemuInfoClear(testQemuInfo *info)
 {
     VIR_FREE(info->infile);
     VIR_FREE(info->outfile);
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 0d570ec31e..c9c36d24c6 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -96,7 +96,7 @@ struct testQemuArgs {
     bool invalidarg;
 };

-struct testQemuInfo {
+struct _testQemuInfo {
     const char *name;
     char *infile;
     char *outfile;
@@ -114,6 +114,8 @@ struct testQemuInfo {
     struct testQemuConf *conf;
 };

+typedef struct _testQemuInfo testQemuInfo;
+
 virDomainXMLOption *testQemuXMLConfInit(void);


@@ -150,11 +152,11 @@ int testQemuCapsIterate(const char *suffix,
                         testQemuCapsIterateCallback callback,
                         void *opaque);

-void testQemuInfoSetArgs(struct testQemuInfo *info,
+void testQemuInfoSetArgs(testQemuInfo *info,
                          struct testQemuConf *conf,
                          ...);
-int testQemuInfoInitArgs(struct testQemuInfo *info);
-void testQemuInfoClear(struct testQemuInfo *info);
+int testQemuInfoInitArgs(testQemuInfo *info);
+void testQemuInfoClear(testQemuInfo *info);

 int testQemuPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
                                          virDomainChrSourceDef *chardev,
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux