mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
xenParsePCI: Replace virStringSplitCount by g_strsplit
Count the number of elements in place just for the check. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
02a0d2e08c
commit
b926959084
@ -372,7 +372,6 @@ xenParsePCI(char *entry)
|
|||||||
virDomainHostdevDefPtr hostdev = NULL;
|
virDomainHostdevDefPtr hostdev = NULL;
|
||||||
g_auto(GStrv) tokens = NULL;
|
g_auto(GStrv) tokens = NULL;
|
||||||
g_auto(GStrv) options = NULL;
|
g_auto(GStrv) options = NULL;
|
||||||
size_t ntokens = 0;
|
|
||||||
size_t nexttoken = 0;
|
size_t nexttoken = 0;
|
||||||
char *str;
|
char *str;
|
||||||
char *nextstr;
|
char *nextstr;
|
||||||
@ -383,11 +382,11 @@ xenParsePCI(char *entry)
|
|||||||
virTristateBool filtered = VIR_TRISTATE_BOOL_ABSENT;
|
virTristateBool filtered = VIR_TRISTATE_BOOL_ABSENT;
|
||||||
|
|
||||||
/* pci=['00:1b.0','0000:00:13.0,permissive=1'] */
|
/* pci=['00:1b.0','0000:00:13.0,permissive=1'] */
|
||||||
if (!(tokens = virStringSplitCount(entry, ":", 3, &ntokens)))
|
if (!(tokens = g_strsplit(entry, ":", 3)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* domain */
|
/* domain */
|
||||||
if (ntokens == 3) {
|
if (g_strv_length(tokens) == 3) {
|
||||||
if (virStrToLong_i(tokens[nexttoken], NULL, 16, &domain) < 0)
|
if (virStrToLong_i(tokens[nexttoken], NULL, 16, &domain) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
nexttoken++;
|
nexttoken++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user