From: Peter Krempa Date: Mon, 22 Mar 2021 16:00:41 +0000 (+0100) Subject: virStorageFileParseBackingStoreStr: use g_strsplit instead of virStringSplitCount X-Git-Tag: v7.3.0-rc1~305 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b18527134baeebcb623c77fcc16ffdc50c555141;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Ján Tomko --- diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index e6bc723d1e..e3ec64486e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -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;