[PATCH 38/40] Replace virStringListJoin by g_strjoinv

Peter Krempa pkrempa at redhat.com
Sat Feb 6 08:33:00 UTC 2021


Our implementation was inspired by glib anyways. The difference is only
the order of arguments.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/bhyve/bhyve_parse_command.c                | 4 ++--
 src/libxl/xen_common.c                         | 2 +-
 src/libxl/xen_xl.c                             | 4 +---
 src/qemu/qemu_process.c                        | 2 +-
 src/storage_file/storage_source_backingstore.c | 4 +---
 src/util/vircgroup.c                           | 2 +-
 6 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c
index 4f1d384da1..2762b7e921 100644
--- a/src/bhyve/bhyve_parse_command.c
+++ b/src/bhyve/bhyve_parse_command.c
@@ -923,7 +923,7 @@ bhyveParseBhyveLoadCommandLine(virDomainDefPtr def,
         /* Set os.bootloader since virDomainDefFormatInternal will only format
          * the bootloader arguments if os->bootloader is set. */
         def->os.bootloader = g_strdup(argv[0]);
-        def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " ");
+        def->os.bootloaderArgs = g_strjoinv(" ", &argv[1]);
     }

     if (def->name == NULL) {
@@ -950,7 +950,7 @@ bhyveParseCustomLoaderCommandLine(virDomainDefPtr def,
         return -1;

     def->os.bootloader = g_strdup(argv[0]);
-    def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " ");
+    def->os.bootloaderArgs = g_strjoinv(" ", &argv[1]);

     return 0;
 }
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 75c65a4135..f852032d8a 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -1659,7 +1659,7 @@ xenMakeIPList(virNetDevIPInfoPtr guestIP)
         if (!address_array[i])
             goto cleanup;
     }
-    ret = virStringListJoin((const char**)address_array, " ");
+    ret = g_strjoinv(" ", address_array);

  cleanup:
     g_strfreev(address_array);
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index a7036ba494..3d44dd1c59 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1421,9 +1421,7 @@ xenFormatXLCPUID(virConfPtr conf, virDomainDefPtr def)
     cpuid_pairs[j] = NULL;

     if (j > 1) {
-        cpuid_string = virStringListJoin((const char **)cpuid_pairs, ",");
-        if (!cpuid_string)
-            goto cleanup;
+        cpuid_string = g_strjoinv(",", cpuid_pairs);

         if (xenConfigSetString(conf, "cpuid", cpuid_string) < 0)
             goto cleanup;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d24ef789ab..13231ed0de 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5489,7 +5489,7 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
             if (n > 0) {
                 g_autofree char *str = NULL;

-                str = virStringListJoin((const char **)features, ", ");
+                str = g_strjoinv(", ", features);
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("Some features cannot be reliably used "
                                  "with this QEMU: %s"), str);
diff --git a/src/storage_file/storage_source_backingstore.c b/src/storage_file/storage_source_backingstore.c
index 8e1606a1fe..5e2db3d390 100644
--- a/src/storage_file/storage_source_backingstore.c
+++ b/src/storage_file/storage_source_backingstore.c
@@ -168,9 +168,7 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src,
     parts = g_strsplit(hostport, "\\:", 0);
     if (!parts)
         goto error;
-    src->hosts[src->nhosts-1].name = virStringListJoin((const char **)parts, ":");
-    if (!src->hosts[src->nhosts-1].name)
-        goto error;
+    src->hosts[src->nhosts-1].name = g_strjoinv(":", parts);

     src->hosts[src->nhosts-1].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
     src->hosts[src->nhosts-1].socket = NULL;
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index a7e2728dd7..abaf1c98f7 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -831,7 +831,7 @@ virCgroupSetPartitionSuffix(const char *path, char **res)
             goto cleanup;
     }

-    if (!(*res = virStringListJoin((const char **)tokens, "/")))
+    if (!(*res = g_strjoinv("/", tokens)))
         goto cleanup;

     ret = 0;
-- 
2.29.2




More information about the libvir-list mailing list