diff --git a/daemon/control_tcp.c b/daemon/control_tcp.c index 370154396..723b3a105 100644 --- a/daemon/control_tcp.c +++ b/daemon/control_tcp.c @@ -105,7 +105,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 1fd69f0c9..c3016710e 100644 --- a/daemon/control_udp.c +++ b/daemon/control_udp.c @@ -61,7 +61,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; @@ -130,7 +130,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 91eebb6d0..045495333 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -36,6 +36,12 @@ int pcre2_multi_match(pcre2_code *, const char *, unsigned int, parse_func, void INLINE void strmove(char **, char **); INLINE void strdupfree(char **, const char *); +#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 ***/