]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainDiskAddISCSIPoolSourceHost: use g_strsplit instead of virStringSplitCount
authorPeter Krempa <pkrempa@redhat.com>
Mon, 22 Mar 2021 16:00:41 +0000 (17:00 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 12 Apr 2021 13:55:09 +0000 (15:55 +0200)
Count the elements directly using g_strv_length.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c

index 83415f927194d79a53e9e88a94e89cd2a818e14e..e2427848edb9cc196147e3dbfe0d2821ac4c07ab 100644 (file)
@@ -32117,7 +32117,6 @@ virDomainDiskAddISCSIPoolSourceHost(virStorageSourcePtr src,
                                     virStoragePoolDefPtr pooldef)
 {
     g_auto(GStrv) tokens = NULL;
-    size_t ntokens;
 
     /* Only support one host */
     if (pooldef->source.nhost != 1) {
@@ -32138,10 +32137,10 @@ virDomainDiskAddISCSIPoolSourceHost(virStorageSourcePtr src,
         src->hosts[0].port = 3260;
 
     /* iscsi volume has name like "unit:0:0:1" */
-    if (!(tokens = virStringSplitCount(src->srcpool->volume, ":", 0, &ntokens)))
+    if (!(tokens = g_strsplit(src->srcpool->volume, ":", 0)))
         return -1;
 
-    if (ntokens != 4) {
+    if (g_strv_length(tokens) != 4) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unexpected iscsi volume name '%s'"),
                        src->srcpool->volume);