diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index e7800b4c7..c6acffaca 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -247,12 +247,15 @@ str *call_lookup_udp(char **out) { } -static int info_parse_func(char **a, void **ret, void *p) { +static bool info_parse_func(char **a, void **ret, void *p) { + if (!a[0] || !a[1]) + return false; + GHashTable *ih = p; g_hash_table_replace(ih, strdup(a[0]), strdup(a[1])); - return -1; + return false; } static void info_parse(const char *s, GHashTable *ih) { @@ -260,7 +263,10 @@ static void info_parse(const char *s, GHashTable *ih) { } -static int streams_parse_func(char **a, void **ret, void *p) { +static bool streams_parse_func(char **a, void **ret, void *p) { + if (!a[0] || !a[1]) + return false; + struct stream_params *sp; int *i; @@ -284,12 +290,12 @@ static int streams_parse_func(char **a, void **ret, void *p) { goto fail; *ret = sp; - return 0; + return true; fail: ilog(LOG_WARNING, "Failed to parse a media stream: %s%s:%s%s", FMT_M(a[0], a[1])); g_slice_free1(sizeof(*sp), sp); - return -1; + return false; } diff --git a/daemon/helpers.c b/daemon/helpers.c index 3ed605499..a6d43f198 100644 --- a/daemon/helpers.c +++ b/daemon/helpers.c @@ -104,7 +104,7 @@ int pcre_multi_match(pcre *re, pcre_extra *ree, const char *s, unsigned int num, el[i] = (ov[0] == -1) ? NULL : g_strndup(s + start + ov[0], ov[1] - ov[0]); } - if (!f(el, &ins, p)) + if (f(el, &ins, p)) g_queue_push_tail(q, ins); for (i = 0; i < num; i++) { diff --git a/include/helpers.h b/include/helpers.h index 3b58c7a13..d4c2c26cb 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -30,7 +30,7 @@ /*** PROTOTYPES ***/ -typedef int (*parse_func)(char **, void **, void *); +typedef bool (*parse_func)(char **, void **, void *); int pcre_multi_match(pcre *, pcre_extra *, const char *, unsigned int, parse_func, void *, GQueue *); INLINE void strmove(char **, char **);