mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
parent
d9c3b652ef
commit
def579e88a
@ -860,10 +860,10 @@ virshParseRateStr(vshControl *ctl,
|
|||||||
g_auto(GStrv) tok = NULL;
|
g_auto(GStrv) tok = NULL;
|
||||||
size_t ntok;
|
size_t ntok;
|
||||||
|
|
||||||
if (!(tok = virStringSplitCount(rateStr, ",", 0, &ntok)))
|
if (!(tok = g_strsplit(rateStr, ",", 0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (ntok > 4) {
|
if ((ntok = g_strv_length(tok)) > 4) {
|
||||||
vshError(ctl, _("Rate string '%s' has too many fields"), rateStr);
|
vshError(ctl, _("Rate string '%s' has too many fields"), rateStr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user