diff --git a/src/core/wee-string.c b/src/core/wee-string.c index cbd69738d..d54e24ec2 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -947,13 +947,13 @@ string_regex_flags (const char *regex, int default_flags, int *flags) */ int -string_regcomp (regex_t *preg, const char *regex, int default_flags) +string_regcomp (void *preg, const char *regex, int default_flags) { const char *ptr_regex; int flags; ptr_regex = string_regex_flags (regex, default_flags, &flags); - return regcomp (preg, ptr_regex, flags); + return regcomp ((regex_t *)preg, ptr_regex, flags); } /* @@ -1274,7 +1274,7 @@ string_replace_regex_get_replace (const char *string, regmatch_t *regex_match, */ char * -string_replace_regex (const char *string, regex_t *regex, const char *replace) +string_replace_regex (const char *string, void *regex, const char *replace) { char *result, *result2, *str_replace; int length, length_replace, start_offset, i, rc, end; @@ -1297,7 +1297,8 @@ string_replace_regex (const char *string, regex_t *regex, const char *replace) regex_match[i].rm_so = -1; } - rc = regexec (regex, result + start_offset, 10, regex_match, 0); + rc = regexec ((regex_t *)regex, result + start_offset, 10, regex_match, + 0); /* * no match found: exit the loop (if rm_eo == 0, it is an empty match * at beginning of string: we consider there is no match, to prevent an diff --git a/src/core/wee-string.h b/src/core/wee-string.h index 4fdd229d7..15c3cb697 100644 --- a/src/core/wee-string.h +++ b/src/core/wee-string.h @@ -51,13 +51,13 @@ extern char *string_convert_escaped_chars (const char *string); extern char *string_mask_to_regex (const char *mask); extern const char *string_regex_flags (const char *regex, int default_flags, int *flags); -extern int string_regcomp (regex_t *preg, const char *regex, int default_flags); +extern int string_regcomp (void *preg, const char *regex, int default_flags); extern int string_has_highlight (const char *string, const char *highlight_words); extern int string_has_highlight_regex_compiled (const char *string, regex_t *regex); extern int string_has_highlight_regex (const char *string, const char *regex); -extern char *string_replace_regex (const char *string, regex_t *regex, +extern char *string_replace_regex (const char *string, void *regex, const char *replace); extern char **string_split (const char *string, const char *separators, int keep_eol, int num_items_max, int *num_items); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 1b939ef6f..2cb562cdb 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -28,7 +28,6 @@ extern "C" { #include #include -#include /* some systems like GNU/Hurd do not define PATH_MAX */ #ifndef PATH_MAX @@ -244,11 +243,11 @@ struct t_weechat_plugin char *(*string_mask_to_regex) (const char *mask); const char *(*string_regex_flags) (const char *regex, int default_flags, int *flags); - int (*string_regcomp) (regex_t *preg, const char *regex, int default_flags); + int (*string_regcomp) (void *preg, const char *regex, int default_flags); int (*string_has_highlight) (const char *string, const char *highlight_words); int (*string_has_highlight_regex) (const char *string, const char *regex); - char *(*string_replace_regex) (const char *string, regex_t *regex, + char *(*string_replace_regex) (const char *string, void *regex, const char *replace); char **(*string_split) (const char *string, const char *separators, int keep_eol, int num_items_max, int *num_items);