mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
virStorageFileParseBackingStoreStr: use g_strsplit instead of virStringSplitCount
The presence of the second element can be checked by looking at it directly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
e49eb0aaa7
commit
b18527134b
@ -192,17 +192,16 @@ virStorageFileParseBackingStoreStr(const char *str,
|
||||
char **target,
|
||||
unsigned int *chainIndex)
|
||||
{
|
||||
size_t nstrings;
|
||||
unsigned int idx = 0;
|
||||
char *suffix;
|
||||
g_auto(GStrv) strings = NULL;
|
||||
|
||||
*chainIndex = 0;
|
||||
|
||||
if (!(strings = virStringSplitCount(str, "[", 2, &nstrings)))
|
||||
if (!(strings = g_strsplit(str, "[", 2)))
|
||||
return -1;
|
||||
|
||||
if (nstrings == 2) {
|
||||
if (strings[0] && strings[1]) {
|
||||
if (virStrToLong_uip(strings[1], &suffix, 10, &idx) < 0 ||
|
||||
STRNEQ(suffix, "]"))
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user