vshCompleterFilter() function returns an
invariant result, so turn it to void. Remove
redundant check which depends on its returning value
Fixes: b668054209 ("tools: Use glib memory functions in vshCompleterFilter")
Signed-off-by: Artem Chernyshev <artem.chernyshev(a)red-soft.ru>
---
tools/vsh.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index 75a189bcb7..6b6a677b47 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2701,7 +2701,7 @@ vshReadlineCommandFindOpt(const vshCmd *partial)
}
-static int
+static void
vshCompleterFilter(char ***list,
const char *text)
{
@@ -2711,7 +2711,7 @@ vshCompleterFilter(char ***list,
size_t i;
if (!list || !*list)
- return 0;
+ return;
list_len = g_strv_length(*list);
newList = g_new0(char *, list_len + 1);
@@ -2729,7 +2729,6 @@ vshCompleterFilter(char ***list,
newList = g_renew(char *, newList, newList_len + 1);
g_free(*list);
*list = newList;
- return 0;
}
@@ -2805,8 +2804,7 @@ vshReadlineParse(const char *text, int state)
/* For string list returned by completers we have to do
* filtering based on @text because completers returns all
* possible strings. */
- if (vshCompleterFilter(&list, text) < 0)
- goto cleanup;
+ vshCompleterFilter(&list, text);
}
if (list) {
@@ -2814,7 +2812,6 @@ vshReadlineParse(const char *text, int state)
list_index++;
}
- cleanup:
if (!ret) {
g_clear_pointer(&list, g_strfreev);
list_index = 0;
--
2.43.0