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

2021-04-07 Thread Ján Tomko

On a Thursday in 2021, Peter Krempa wrote:

Count the elements after splitting the string.

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



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature


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

2021-04-01 Thread Peter Krempa
Count the elements after splitting the string.

Signed-off-by: Peter Krempa 
---
 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, )))
+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