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

Peter Krempa posted 39 patches 4 years, 10 months ago
[PATCH 15/39] virLogParseFilter: Replace virStringSplitCount by g_strsplit
Posted by Peter Krempa 4 years, 10 months ago
We don't really need the count.

Signed-off-by: Peter Krempa <pkrempa@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

Re: [PATCH 15/39] virLogParseFilter: Replace virStringSplitCount by g_strsplit
Posted by Ján Tomko 4 years, 10 months ago
On a Thursday in 2021, Peter Krempa wrote:
>We don't really need the count.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/util/virlog.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano