[PATCH 10/39] virStorageFileParseBackingStoreStr: use g_strsplit instead of virStringSplitCount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The presence of the second element can be checked by looking at it
directly.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virstoragefile.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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;
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux