core: replace "regex_t *" by "void *" in string functions (fix ruby compilation error with autotools)

v2.8-utf8proc
Sebastien Helleu 2014-02-04 22:12:45 +01:00
parent 66158f41f2
commit a03653273c
3 changed files with 9 additions and 9 deletions

View File

@ -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

View File

@ -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);

View File

@ -28,7 +28,6 @@ extern "C" {
#include <sys/types.h>
#include <sys/socket.h>
#include <regex.h>
/* 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);