[PATCH 08/39] virDomainDiskAddISCSIPoolSourceHost: use g_strsplit instead of virStringSplitCount

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

 



Count the elements directly using g_strv_length.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d050a519c6..2ab476dfdb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -32080,7 +32080,6 @@ virDomainDiskAddISCSIPoolSourceHost(virStorageSourcePtr src,
                                     virStoragePoolDefPtr pooldef)
 {
     g_auto(GStrv) tokens = NULL;
-    size_t ntokens;

     /* Only support one host */
     if (pooldef->source.nhost != 1) {
@@ -32101,10 +32100,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);
-- 
2.29.2




[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