On Monday, 16 March 2020 14:59:28 CET Richard W.M. Jones wrote:
diff --git a/daemon/utils.c b/daemon/utils.c index 1cf1b07f6..21008b40e 100644 --- a/daemon/utils.c +++ b/daemon/utils.c @@ -24,6 +24,7 @@
#include <stdio.h> #include <stdlib.h> +#include <stdbool.h>
Since daemon.h now includes stdbool.h, this include is reduntand.
+/** + * Filter a list of strings. Returns a newly allocated list of only + * the strings where C<p (str) == true>. + * + * B<Note> it does not copy the strings, be careful not to double-free + * them. + */ +char ** +filter_list (bool (*p) (const char *str), char **strs) +{ + DECLARE_STRINGSBUF (ret);
Theoretically speaking, this stringsbuf is leaked on error; CLEANUP_FREE_STRINGSBUF can't be used though, as it frees also the strings and not just the string array. (Same note as in patch #1) -- Pino Toscano