[PATCH 15/39] virLogParseFilter: Replace virStringSplitCount by g_strsplit

Peter Krempa pkrempa at redhat.com
Thu Apr 1 13:52:14 UTC 2021


We don't really need the count.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virlog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virlog.c b/src/util/virlog.c
index 57eb0de538..8a4cfbfdc2 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1556,7 +1556,6 @@ virLogParseOutput(const char *src)
 virLogFilterPtr
 virLogParseFilter(const char *src)
 {
-    size_t count = 0;
     virLogPriority prio;
     g_auto(GStrv) tokens = NULL;
     char *match = NULL;
@@ -1564,7 +1563,8 @@ virLogParseFilter(const char *src)
     VIR_DEBUG("filter=%s", src);

     /* split our format prio:match_str to tokens and parse them individually */
-    if (!(tokens = virStringSplitCount(src, ":", 0, &count)) || count != 2) {
+    if (!(tokens = g_strsplit(src, ":", 0)) ||
+        !tokens[0] || !tokens[1]) {
         virReportError(VIR_ERR_INVALID_ARG,
                        _("Malformed format for filter '%s'"), src);
         return NULL;
-- 
2.29.2




More information about the libvir-list mailing list