compat/regex: get rid of old-style definition
These files mostly used ANSI style function definitions, but with small number of old-style ones. Convert them to consistently use ANSI style. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b50f37098f
commit
178b33157a
@ -230,10 +230,9 @@ btowc (int c)
|
|||||||
are set in BUFP on entry. */
|
are set in BUFP on entry. */
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
re_compile_pattern (pattern, length, bufp)
|
re_compile_pattern (const char *pattern,
|
||||||
const char *pattern;
|
size_t length,
|
||||||
size_t length;
|
struct re_pattern_buffer *bufp)
|
||||||
struct re_pattern_buffer *bufp;
|
|
||||||
{
|
{
|
||||||
reg_errcode_t ret;
|
reg_errcode_t ret;
|
||||||
|
|
||||||
@ -271,8 +270,7 @@ reg_syntax_t re_syntax_options;
|
|||||||
defined in regex.h. We return the old syntax. */
|
defined in regex.h. We return the old syntax. */
|
||||||
|
|
||||||
reg_syntax_t
|
reg_syntax_t
|
||||||
re_set_syntax (syntax)
|
re_set_syntax (reg_syntax_t syntax)
|
||||||
reg_syntax_t syntax;
|
|
||||||
{
|
{
|
||||||
reg_syntax_t ret = re_syntax_options;
|
reg_syntax_t ret = re_syntax_options;
|
||||||
|
|
||||||
@ -284,8 +282,7 @@ weak_alias (__re_set_syntax, re_set_syntax)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
re_compile_fastmap (bufp)
|
re_compile_fastmap (struct re_pattern_buffer *bufp)
|
||||||
struct re_pattern_buffer *bufp;
|
|
||||||
{
|
{
|
||||||
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
|
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
|
||||||
char *fastmap = bufp->fastmap;
|
char *fastmap = bufp->fastmap;
|
||||||
@ -484,10 +481,9 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||||||
the return codes and their meanings.) */
|
the return codes and their meanings.) */
|
||||||
|
|
||||||
int
|
int
|
||||||
regcomp (preg, pattern, cflags)
|
regcomp (regex_t *__restrict preg,
|
||||||
regex_t *__restrict preg;
|
const char *__restrict pattern,
|
||||||
const char *__restrict pattern;
|
int cflags)
|
||||||
int cflags;
|
|
||||||
{
|
{
|
||||||
reg_errcode_t ret;
|
reg_errcode_t ret;
|
||||||
reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
|
reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
|
||||||
@ -650,8 +646,7 @@ free_dfa_content (re_dfa_t *dfa)
|
|||||||
/* Free dynamically allocated space used by PREG. */
|
/* Free dynamically allocated space used by PREG. */
|
||||||
|
|
||||||
void
|
void
|
||||||
regfree (preg)
|
regfree (regex_t *preg)
|
||||||
regex_t *preg;
|
|
||||||
{
|
{
|
||||||
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
|
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
|
||||||
if (BE (dfa != NULL, 1))
|
if (BE (dfa != NULL, 1))
|
||||||
|
@ -218,12 +218,12 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx)
|
|||||||
We return 0 if we find a match and REG_NOMATCH if not. */
|
We return 0 if we find a match and REG_NOMATCH if not. */
|
||||||
|
|
||||||
int
|
int
|
||||||
regexec (preg, string, nmatch, pmatch, eflags)
|
regexec (
|
||||||
const regex_t *__restrict preg;
|
const regex_t *__restrict preg,
|
||||||
const char *__restrict string;
|
const char *__restrict string,
|
||||||
size_t nmatch;
|
size_t nmatch,
|
||||||
regmatch_t pmatch[];
|
regmatch_t pmatch[],
|
||||||
int eflags;
|
int eflags)
|
||||||
{
|
{
|
||||||
reg_errcode_t err;
|
reg_errcode_t err;
|
||||||
int start, length;
|
int start, length;
|
||||||
@ -303,11 +303,11 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
|
|||||||
match was found and -2 indicates an internal error. */
|
match was found and -2 indicates an internal error. */
|
||||||
|
|
||||||
int
|
int
|
||||||
re_match (bufp, string, length, start, regs)
|
re_match (struct re_pattern_buffer *bufp,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string,
|
||||||
const char *string;
|
int length,
|
||||||
int length, start;
|
int start,
|
||||||
struct re_registers *regs;
|
struct re_registers *regs)
|
||||||
{
|
{
|
||||||
return re_search_stub (bufp, string, length, start, 0, length, regs, 1);
|
return re_search_stub (bufp, string, length, start, 0, length, regs, 1);
|
||||||
}
|
}
|
||||||
@ -316,11 +316,10 @@ weak_alias (__re_match, re_match)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
re_search (bufp, string, length, start, range, regs)
|
re_search (struct re_pattern_buffer *bufp,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string,
|
||||||
const char *string;
|
int length, int start, int range,
|
||||||
int length, start, range;
|
struct re_registers *regs)
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
return re_search_stub (bufp, string, length, start, range, length, regs, 0);
|
return re_search_stub (bufp, string, length, start, range, length, regs, 0);
|
||||||
}
|
}
|
||||||
@ -329,11 +328,10 @@ weak_alias (__re_search, re_search)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop)
|
re_match_2 (struct re_pattern_buffer *bufp,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string1, int length1,
|
||||||
const char *string1, *string2;
|
const char *string2, int length2, int start,
|
||||||
int length1, length2, start, stop;
|
struct re_registers *regs, int stop)
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
return re_search_2_stub (bufp, string1, length1, string2, length2,
|
return re_search_2_stub (bufp, string1, length1, string2, length2,
|
||||||
start, 0, regs, stop, 1);
|
start, 0, regs, stop, 1);
|
||||||
@ -343,11 +341,10 @@ weak_alias (__re_match_2, re_match_2)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop)
|
re_search_2 (struct re_pattern_buffer *bufp,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string1, int length1,
|
||||||
const char *string1, *string2;
|
const char *string2, int length2, int start,
|
||||||
int length1, length2, start, range, stop;
|
int range, struct re_registers *regs, int stop)
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
return re_search_2_stub (bufp, string1, length1, string2, length2,
|
return re_search_2_stub (bufp, string1, length1, string2, length2,
|
||||||
start, range, regs, stop, 0);
|
start, range, regs, stop, 0);
|
||||||
@ -357,12 +354,11 @@ weak_alias (__re_search_2, re_search_2)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
|
re_search_2_stub (struct re_pattern_buffer *bufp,
|
||||||
stop, ret_len)
|
const char *string1, int length1,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string2, int length2, int start,
|
||||||
const char *string1, *string2;
|
int range, struct re_registers *regs,
|
||||||
int length1, length2, start, range, stop, ret_len;
|
int stop, int ret_len)
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
int rval;
|
int rval;
|
||||||
@ -402,11 +398,10 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
|
|||||||
otherwise the position of the match is returned. */
|
otherwise the position of the match is returned. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
|
re_search_stub (struct re_pattern_buffer *bufp,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string, int length, int start,
|
||||||
const char *string;
|
int range, int stop,
|
||||||
int length, start, range, stop, ret_len;
|
struct re_registers *regs, int ret_len)
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
reg_errcode_t result;
|
reg_errcode_t result;
|
||||||
regmatch_t *pmatch;
|
regmatch_t *pmatch;
|
||||||
@ -490,10 +485,9 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
re_copy_regs (regs, pmatch, nregs, regs_allocated)
|
re_copy_regs (struct re_registers *regs,
|
||||||
struct re_registers *regs;
|
regmatch_t *pmatch,
|
||||||
regmatch_t *pmatch;
|
int nregs, int regs_allocated)
|
||||||
int nregs, regs_allocated;
|
|
||||||
{
|
{
|
||||||
int rval = REGS_REALLOCATE;
|
int rval = REGS_REALLOCATE;
|
||||||
int i;
|
int i;
|
||||||
@ -570,11 +564,11 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated)
|
|||||||
freeing the old data. */
|
freeing the old data. */
|
||||||
|
|
||||||
void
|
void
|
||||||
re_set_registers (bufp, regs, num_regs, starts, ends)
|
re_set_registers (struct re_pattern_buffer *bufp,
|
||||||
struct re_pattern_buffer *bufp;
|
struct re_registers *regs,
|
||||||
struct re_registers *regs;
|
unsigned num_regs,
|
||||||
unsigned num_regs;
|
regoff_t *starts,
|
||||||
regoff_t *starts, *ends;
|
regoff_t *ends)
|
||||||
{
|
{
|
||||||
if (num_regs)
|
if (num_regs)
|
||||||
{
|
{
|
||||||
@ -621,13 +615,11 @@ re_exec (s)
|
|||||||
(START + RANGE >= 0 && START + RANGE <= LENGTH) */
|
(START + RANGE >= 0 && START + RANGE <= LENGTH) */
|
||||||
|
|
||||||
static reg_errcode_t
|
static reg_errcode_t
|
||||||
re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
|
re_search_internal (const regex_t *preg,
|
||||||
eflags)
|
const char *string,
|
||||||
const regex_t *preg;
|
int length, int start, int range, int stop,
|
||||||
const char *string;
|
size_t nmatch, regmatch_t pmatch[],
|
||||||
int length, start, range, stop, eflags;
|
int eflags)
|
||||||
size_t nmatch;
|
|
||||||
regmatch_t pmatch[];
|
|
||||||
{
|
{
|
||||||
reg_errcode_t err;
|
reg_errcode_t err;
|
||||||
const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
|
const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
|
||||||
@ -947,8 +939,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static reg_errcode_t
|
static reg_errcode_t
|
||||||
prune_impossible_nodes (mctx)
|
prune_impossible_nodes (re_match_context_t *mctx)
|
||||||
re_match_context_t *mctx;
|
|
||||||
{
|
{
|
||||||
const re_dfa_t *const dfa = mctx->dfa;
|
const re_dfa_t *const dfa = mctx->dfa;
|
||||||
int halt_node, match_last;
|
int halt_node, match_last;
|
||||||
|
Loading…
Reference in New Issue
Block a user