virshParseRateStr: Use g_strsplit instead of virStringSplitCount

Count the elements after splitting the string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-03-23 09:10:18 +01:00
parent d9c3b652ef
commit def579e88a

View File

@ -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;
}