[PATCH 21/39] virshParseRateStr: Use g_strsplit instead of virStringSplitCount

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

 



Count the elements after splitting the string.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/virsh-domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 37be298809..532169d8d7 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -860,10 +860,10 @@ virshParseRateStr(vshControl *ctl,
     g_auto(GStrv) tok = NULL;
     size_t ntok;

-    if (!(tok = virStringSplitCount(rateStr, ",", 0, &ntok)))
+    if (!(tok = g_strsplit(rateStr, ",", 0)))
         return -1;

-    if (ntok > 4) {
+    if ((ntok = g_strv_length(tok)) > 4) {
         vshError(ctl, _("Rate string '%s' has too many fields"), rateStr);
         return -1;
     }
-- 
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