diff --git a/daemon/control_tcp.c b/daemon/control_tcp.c index 73aa3cfa4..96c8af603 100644 --- a/daemon/control_tcp.c +++ b/daemon/control_tcp.c @@ -102,7 +102,7 @@ static int control_stream_parse(struct streambuf_stream *s, char *line) { free(output); } - pcre2_substring_list_free((PCRE2_SPTR *) out); + pcre2_substring_list_free((SUBSTRING_FREE_ARG) out); pcre2_match_data_free(md); log_info_pop(); return 1; diff --git a/daemon/control_udp.c b/daemon/control_udp.c index 8164cea62..446010f22 100644 --- a/daemon/control_udp.c +++ b/daemon/control_udp.c @@ -62,7 +62,7 @@ static void control_udp_incoming(struct obj *obj, struct udp_buffer *udp_buf) { socket_sendiov(udp_buf->listener, iov, iovlen, &udp_buf->sin, &udp_buf->local_addr); - pcre2_substring_list_free((PCRE2_SPTR *) out); + pcre2_substring_list_free((SUBSTRING_FREE_ARG) out); pcre2_match_data_free(md); return; @@ -135,7 +135,7 @@ static void control_udp_incoming(struct obj *obj, struct udp_buffer *udp_buf) { cookie_cache_remove(&u->cookie_cache, &cookie); out: - pcre2_substring_list_free((PCRE2_SPTR *) out); + pcre2_substring_list_free((SUBSTRING_FREE_ARG) out); pcre2_match_data_free(md); log_info_pop(); } diff --git a/include/helpers.h b/include/helpers.h index b62919789..f717a57ac 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -30,6 +30,12 @@ typedef bool (*parse_func)(char **, void **, void *); int pcre2_multi_match(pcre2_code *, const char *, unsigned int, parse_func, void *, GQueue *); +#if PCRE2_MAJOR > 10 || (PCRE2_MAJOR == 10 && PCRE2_MINOR >= 43) +#define SUBSTRING_FREE_ARG PCRE2_UCHAR ** +#else +#define SUBSTRING_FREE_ARG PCRE2_SPTR * +#endif + /*** GLIB HELPERS ***/