mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
[BZ #1231]
2005-08-23 Paul Eggert <eggert@cs.ucla.edu> [BZ #1231] * posix/regex_internal.c (re_string_skip_chars, register_state, calc_state_hash): Remove forward decls. * posix/regexec.c (acquire_init_state_context, check_halt_node_context, proceed_next_node, pop_fail_stack, sub_epsilon_src_nodes, clean_state_log_if_needed): Likewise. * posix/regex.c: No need to use K&R definitions for static functions. * posix/regex_internal.c: Likewise.
This commit is contained in:
parent
72c7a71de4
commit
e2f5526407
12
ChangeLog
12
ChangeLog
@ -1,5 +1,17 @@
|
||||
2005-08-23 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
[BZ #1231]
|
||||
* posix/regex_internal.c (re_string_skip_chars, register_state,
|
||||
calc_state_hash): Remove forward decls.
|
||||
* posix/regexec.c (acquire_init_state_context, check_halt_node_context,
|
||||
proceed_next_node, pop_fail_stack, sub_epsilon_src_nodes,
|
||||
clean_state_log_if_needed): Likewise.
|
||||
|
||||
2005-10-13 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* posix/regex.c: No need to use K&R definitions for static functions.
|
||||
* posix/regex_internal.c: Likewise.
|
||||
|
||||
[BZ #1466]
|
||||
* sysdeps/generic/s_csqrt.c (__csqrt): For zero real part, return
|
||||
principal square root.
|
||||
|
@ -22,13 +22,6 @@ static void re_string_construct_common (const char *str, int len,
|
||||
re_string_t *pstr,
|
||||
RE_TRANSLATE_TYPE trans, int icase,
|
||||
const re_dfa_t *dfa) internal_function;
|
||||
#ifdef RE_ENABLE_I18N
|
||||
static int re_string_skip_chars (re_string_t *pstr, int new_raw_idx,
|
||||
wint_t *last_wc) internal_function;
|
||||
#endif /* RE_ENABLE_I18N */
|
||||
static reg_errcode_t register_state (const re_dfa_t *dfa,
|
||||
re_dfastate_t *newstate,
|
||||
unsigned int hash) internal_function;
|
||||
static re_dfastate_t *create_ci_newstate (const re_dfa_t *dfa,
|
||||
const re_node_set *nodes,
|
||||
unsigned int hash) internal_function;
|
||||
@ -36,8 +29,6 @@ static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa,
|
||||
const re_node_set *nodes,
|
||||
unsigned int context,
|
||||
unsigned int hash) internal_function;
|
||||
static inline unsigned int calc_state_hash (const re_node_set *nodes,
|
||||
unsigned int context) internal_function;
|
||||
|
||||
/* Functions for string operation. */
|
||||
|
||||
@ -45,12 +36,8 @@ static inline unsigned int calc_state_hash (const re_node_set *nodes,
|
||||
re_string_reconstruct before using the object. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_string_allocate (pstr, str, len, init_len, trans, icase, dfa)
|
||||
re_string_t *pstr;
|
||||
const char *str;
|
||||
int len, init_len, icase;
|
||||
RE_TRANSLATE_TYPE trans;
|
||||
const re_dfa_t *dfa;
|
||||
re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
|
||||
RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
|
||||
{
|
||||
reg_errcode_t ret;
|
||||
int init_buf_len;
|
||||
@ -76,12 +63,8 @@ re_string_allocate (pstr, str, len, init_len, trans, icase, dfa)
|
||||
/* This function allocate the buffers, and initialize them. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_string_construct (pstr, str, len, trans, icase, dfa)
|
||||
re_string_t *pstr;
|
||||
const char *str;
|
||||
int len, icase;
|
||||
RE_TRANSLATE_TYPE trans;
|
||||
const re_dfa_t *dfa;
|
||||
re_string_construct (re_string_t *pstr, const char *str, int len,
|
||||
RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
|
||||
{
|
||||
reg_errcode_t ret;
|
||||
memset (pstr, '\0', sizeof (re_string_t));
|
||||
@ -142,9 +125,7 @@ re_string_construct (pstr, str, len, trans, icase, dfa)
|
||||
/* Helper functions for re_string_allocate, and re_string_construct. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_string_realloc_buffers (pstr, new_buf_len)
|
||||
re_string_t *pstr;
|
||||
int new_buf_len;
|
||||
re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
|
||||
{
|
||||
#ifdef RE_ENABLE_I18N
|
||||
if (pstr->mb_cur_max > 1)
|
||||
@ -176,13 +157,9 @@ re_string_realloc_buffers (pstr, new_buf_len)
|
||||
|
||||
|
||||
static void
|
||||
re_string_construct_common (str, len, pstr, trans, icase, dfa)
|
||||
const char *str;
|
||||
int len;
|
||||
re_string_t *pstr;
|
||||
RE_TRANSLATE_TYPE trans;
|
||||
int icase;
|
||||
const re_dfa_t *dfa;
|
||||
re_string_construct_common (const char *str, int len, re_string_t *pstr,
|
||||
RE_TRANSLATE_TYPE trans, int icase,
|
||||
const re_dfa_t *dfa)
|
||||
{
|
||||
pstr->raw_mbs = (const unsigned char *) str;
|
||||
pstr->len = len;
|
||||
@ -211,8 +188,7 @@ re_string_construct_common (str, len, pstr, trans, icase, dfa)
|
||||
built and starts from PSTR->VALID_LEN. */
|
||||
|
||||
static void
|
||||
build_wcs_buffer (pstr)
|
||||
re_string_t *pstr;
|
||||
build_wcs_buffer (re_string_t *pstr)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
unsigned char buf[MB_LEN_MAX];
|
||||
@ -279,8 +255,7 @@ build_wcs_buffer (pstr)
|
||||
but for REG_ICASE. */
|
||||
|
||||
static int
|
||||
build_wcs_upper_buffer (pstr)
|
||||
re_string_t *pstr;
|
||||
build_wcs_upper_buffer (re_string_t *pstr)
|
||||
{
|
||||
mbstate_t prev_st;
|
||||
int src_idx, byte_idx, end_idx, remain_len;
|
||||
@ -495,10 +470,8 @@ build_wcs_upper_buffer (pstr)
|
||||
Return the index. */
|
||||
|
||||
static int
|
||||
re_string_skip_chars (pstr, new_raw_idx, last_wc)
|
||||
re_string_t *pstr;
|
||||
int new_raw_idx;
|
||||
wint_t *last_wc;
|
||||
internal_function
|
||||
re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc)
|
||||
{
|
||||
mbstate_t prev_st;
|
||||
int rawbuf_idx;
|
||||
@ -532,8 +505,7 @@ re_string_skip_chars (pstr, new_raw_idx, last_wc)
|
||||
This function is used in case of REG_ICASE. */
|
||||
|
||||
static void
|
||||
build_upper_buffer (pstr)
|
||||
re_string_t *pstr;
|
||||
build_upper_buffer (re_string_t *pstr)
|
||||
{
|
||||
int char_idx, end_idx;
|
||||
end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
|
||||
@ -555,8 +527,7 @@ build_upper_buffer (pstr)
|
||||
/* Apply TRANS to the buffer in PSTR. */
|
||||
|
||||
static void
|
||||
re_string_translate_buffer (pstr)
|
||||
re_string_t *pstr;
|
||||
re_string_translate_buffer (re_string_t *pstr)
|
||||
{
|
||||
int buf_idx, end_idx;
|
||||
end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
|
||||
@ -576,9 +547,7 @@ re_string_translate_buffer (pstr)
|
||||
convert to upper case in case of REG_ICASE, apply translation. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_string_reconstruct (pstr, idx, eflags)
|
||||
re_string_t *pstr;
|
||||
int idx, eflags;
|
||||
re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
|
||||
{
|
||||
int offset = idx - pstr->raw_mbs_idx;
|
||||
if (BE (offset < 0, 0))
|
||||
@ -767,9 +736,7 @@ re_string_reconstruct (pstr, idx, eflags)
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
re_string_peek_byte_case (pstr, idx)
|
||||
const re_string_t *pstr;
|
||||
int idx;
|
||||
re_string_peek_byte_case (const re_string_t *pstr, int idx)
|
||||
{
|
||||
int ch, off;
|
||||
|
||||
@ -804,8 +771,7 @@ re_string_peek_byte_case (pstr, idx)
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
re_string_fetch_byte_case (pstr)
|
||||
re_string_t *pstr;
|
||||
re_string_fetch_byte_case (re_string_t *pstr)
|
||||
{
|
||||
if (BE (!pstr->mbs_allocated, 1))
|
||||
return re_string_fetch_byte (pstr);
|
||||
@ -841,8 +807,7 @@ re_string_fetch_byte_case (pstr)
|
||||
}
|
||||
|
||||
static void
|
||||
re_string_destruct (pstr)
|
||||
re_string_t *pstr;
|
||||
re_string_destruct (re_string_t *pstr)
|
||||
{
|
||||
#ifdef RE_ENABLE_I18N
|
||||
re_free (pstr->wcs);
|
||||
@ -855,9 +820,7 @@ re_string_destruct (pstr)
|
||||
/* Return the context at IDX in INPUT. */
|
||||
|
||||
static unsigned int
|
||||
re_string_context_at (input, idx, eflags)
|
||||
const re_string_t *input;
|
||||
int idx, eflags;
|
||||
re_string_context_at (const re_string_t *input, int idx, int eflags)
|
||||
{
|
||||
int c;
|
||||
if (BE (idx < 0, 0))
|
||||
@ -901,9 +864,7 @@ re_string_context_at (input, idx, eflags)
|
||||
/* Functions for set operation. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_node_set_alloc (set, size)
|
||||
re_node_set *set;
|
||||
int size;
|
||||
re_node_set_alloc (re_node_set *set, int size)
|
||||
{
|
||||
set->alloc = size;
|
||||
set->nelem = 0;
|
||||
@ -914,9 +875,7 @@ re_node_set_alloc (set, size)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
re_node_set_init_1 (set, elem)
|
||||
re_node_set *set;
|
||||
int elem;
|
||||
re_node_set_init_1 (re_node_set *set, int elem)
|
||||
{
|
||||
set->alloc = 1;
|
||||
set->nelem = 1;
|
||||
@ -931,9 +890,7 @@ re_node_set_init_1 (set, elem)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
re_node_set_init_2 (set, elem1, elem2)
|
||||
re_node_set *set;
|
||||
int elem1, elem2;
|
||||
re_node_set_init_2 (re_node_set *set, int elem1, int elem2)
|
||||
{
|
||||
set->alloc = 2;
|
||||
set->elems = re_malloc (int, 2);
|
||||
@ -962,9 +919,7 @@ re_node_set_init_2 (set, elem1, elem2)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
re_node_set_init_copy (dest, src)
|
||||
re_node_set *dest;
|
||||
const re_node_set *src;
|
||||
re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
|
||||
{
|
||||
dest->nelem = src->nelem;
|
||||
if (src->nelem > 0)
|
||||
@ -988,9 +943,8 @@ re_node_set_init_copy (dest, src)
|
||||
Note: We assume dest->elems is NULL, when dest->alloc is 0. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_node_set_add_intersect (dest, src1, src2)
|
||||
re_node_set *dest;
|
||||
const re_node_set *src1, *src2;
|
||||
re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
|
||||
const re_node_set *src2)
|
||||
{
|
||||
int i1, i2, is, id, delta, sbase;
|
||||
if (src1->nelem == 0 || src2->nelem == 0)
|
||||
@ -1079,9 +1033,8 @@ re_node_set_add_intersect (dest, src1, src2)
|
||||
DEST. Return value indicate the error code or REG_NOERROR if succeeded. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_node_set_init_union (dest, src1, src2)
|
||||
re_node_set *dest;
|
||||
const re_node_set *src1, *src2;
|
||||
re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
|
||||
const re_node_set *src2)
|
||||
{
|
||||
int i1, i2, id;
|
||||
if (src1 != NULL && src1->nelem > 0 && src2 != NULL && src2->nelem > 0)
|
||||
@ -1132,9 +1085,7 @@ re_node_set_init_union (dest, src1, src2)
|
||||
DEST. Return value indicate the error code or REG_NOERROR if succeeded. */
|
||||
|
||||
static reg_errcode_t
|
||||
re_node_set_merge (dest, src)
|
||||
re_node_set *dest;
|
||||
const re_node_set *src;
|
||||
re_node_set_merge (re_node_set *dest, const re_node_set *src)
|
||||
{
|
||||
int is, id, sbase, delta;
|
||||
if (src == NULL || src->nelem == 0)
|
||||
@ -1216,9 +1167,7 @@ re_node_set_merge (dest, src)
|
||||
return -1 if an error is occured, return 1 otherwise. */
|
||||
|
||||
static int
|
||||
re_node_set_insert (set, elem)
|
||||
re_node_set *set;
|
||||
int elem;
|
||||
re_node_set_insert (re_node_set *set, int elem)
|
||||
{
|
||||
int idx;
|
||||
/* In case the set is empty. */
|
||||
@ -1274,9 +1223,7 @@ re_node_set_insert (set, elem)
|
||||
Return -1 if an error is occured, return 1 otherwise. */
|
||||
|
||||
static int
|
||||
re_node_set_insert_last (set, elem)
|
||||
re_node_set *set;
|
||||
int elem;
|
||||
re_node_set_insert_last (re_node_set *set, int elem)
|
||||
{
|
||||
/* Realloc if we need. */
|
||||
if (set->alloc == set->nelem)
|
||||
@ -1298,8 +1245,7 @@ re_node_set_insert_last (set, elem)
|
||||
return 1 if SET1 and SET2 are equivalent, return 0 otherwise. */
|
||||
|
||||
static int
|
||||
re_node_set_compare (set1, set2)
|
||||
const re_node_set *set1, *set2;
|
||||
re_node_set_compare (const re_node_set *set1, const re_node_set *set2)
|
||||
{
|
||||
int i;
|
||||
if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem)
|
||||
@ -1313,9 +1259,7 @@ re_node_set_compare (set1, set2)
|
||||
/* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */
|
||||
|
||||
static int
|
||||
re_node_set_contains (set, elem)
|
||||
const re_node_set *set;
|
||||
int elem;
|
||||
re_node_set_contains (const re_node_set *set, int elem)
|
||||
{
|
||||
unsigned int idx, right, mid;
|
||||
if (set->nelem <= 0)
|
||||
@ -1336,9 +1280,7 @@ re_node_set_contains (set, elem)
|
||||
}
|
||||
|
||||
static void
|
||||
re_node_set_remove_at (set, idx)
|
||||
re_node_set *set;
|
||||
int idx;
|
||||
re_node_set_remove_at (re_node_set *set, int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= set->nelem)
|
||||
return;
|
||||
@ -1352,9 +1294,7 @@ re_node_set_remove_at (set, idx)
|
||||
Or return -1, if an error will be occured. */
|
||||
|
||||
static int
|
||||
re_dfa_add_node (dfa, token)
|
||||
re_dfa_t *dfa;
|
||||
re_token_t token;
|
||||
re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
|
||||
{
|
||||
int type = token.type;
|
||||
if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0))
|
||||
@ -1398,9 +1338,8 @@ re_dfa_add_node (dfa, token)
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
calc_state_hash (nodes, context)
|
||||
const re_node_set *nodes;
|
||||
unsigned int context;
|
||||
internal_function
|
||||
calc_state_hash (const re_node_set *nodes, unsigned int context)
|
||||
{
|
||||
unsigned int hash = nodes->nelem + context;
|
||||
int i;
|
||||
@ -1418,11 +1357,9 @@ calc_state_hash (nodes, context)
|
||||
- We never return non-NULL value in case of any errors, it is for
|
||||
optimization. */
|
||||
|
||||
static re_dfastate_t*
|
||||
re_acquire_state (err, dfa, nodes)
|
||||
reg_errcode_t *err;
|
||||
const re_dfa_t *dfa;
|
||||
const re_node_set *nodes;
|
||||
static re_dfastate_t *
|
||||
re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
|
||||
const re_node_set *nodes)
|
||||
{
|
||||
unsigned int hash;
|
||||
re_dfastate_t *new_state;
|
||||
@ -1464,11 +1401,8 @@ re_acquire_state (err, dfa, nodes)
|
||||
optimization. */
|
||||
|
||||
static re_dfastate_t*
|
||||
re_acquire_state_context (err, dfa, nodes, context)
|
||||
reg_errcode_t *err;
|
||||
const re_dfa_t *dfa;
|
||||
const re_node_set *nodes;
|
||||
unsigned int context;
|
||||
re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
|
||||
const re_node_set *nodes, unsigned int context)
|
||||
{
|
||||
unsigned int hash;
|
||||
re_dfastate_t *new_state;
|
||||
@ -1503,10 +1437,8 @@ re_acquire_state_context (err, dfa, nodes, context)
|
||||
indicates the error code if failed. */
|
||||
|
||||
static reg_errcode_t
|
||||
register_state (dfa, newstate, hash)
|
||||
const re_dfa_t *dfa;
|
||||
re_dfastate_t *newstate;
|
||||
unsigned int hash;
|
||||
register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
|
||||
unsigned int hash)
|
||||
{
|
||||
struct re_state_table_entry *spot;
|
||||
reg_errcode_t err;
|
||||
@ -1542,10 +1474,8 @@ register_state (dfa, newstate, hash)
|
||||
Return the new state if succeeded, otherwise return NULL. */
|
||||
|
||||
static re_dfastate_t *
|
||||
create_ci_newstate (dfa, nodes, hash)
|
||||
const re_dfa_t *dfa;
|
||||
const re_node_set *nodes;
|
||||
unsigned int hash;
|
||||
create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
unsigned int hash)
|
||||
{
|
||||
int i;
|
||||
reg_errcode_t err;
|
||||
@ -1593,10 +1523,8 @@ create_ci_newstate (dfa, nodes, hash)
|
||||
Return the new state if succeeded, otherwise return NULL. */
|
||||
|
||||
static re_dfastate_t *
|
||||
create_cd_newstate (dfa, nodes, context, hash)
|
||||
const re_dfa_t *dfa;
|
||||
const re_node_set *nodes;
|
||||
unsigned int context, hash;
|
||||
create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
unsigned int context, unsigned int hash)
|
||||
{
|
||||
int i, nctx_nodes = 0;
|
||||
reg_errcode_t err;
|
||||
@ -1669,8 +1597,7 @@ create_cd_newstate (dfa, nodes, context, hash)
|
||||
}
|
||||
|
||||
static void
|
||||
free_state (state)
|
||||
re_dfastate_t *state;
|
||||
free_state (re_dfastate_t *state)
|
||||
{
|
||||
re_node_set_free (&state->non_eps_nodes);
|
||||
re_node_set_free (&state->inveclosure);
|
||||
|
320
posix/regexec.c
320
posix/regexec.c
@ -52,33 +52,21 @@ static int re_search_stub (struct re_pattern_buffer *bufp,
|
||||
int ret_len) internal_function;
|
||||
static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
|
||||
int nregs, int regs_allocated) internal_function;
|
||||
static inline re_dfastate_t *acquire_init_state_context
|
||||
(reg_errcode_t *err, const re_match_context_t *mctx, int idx)
|
||||
__attribute ((always_inline)) internal_function;
|
||||
static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx)
|
||||
internal_function;
|
||||
static int check_matching (re_match_context_t *mctx, int fl_longest_match,
|
||||
int *p_match_first) internal_function;
|
||||
static int check_halt_node_context (const re_dfa_t *dfa, int node,
|
||||
unsigned int context) internal_function;
|
||||
static int check_halt_state_context (const re_match_context_t *mctx,
|
||||
const re_dfastate_t *state, int idx)
|
||||
internal_function;
|
||||
static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
|
||||
regmatch_t *prev_idx_match, int cur_node,
|
||||
int cur_idx, int nmatch) internal_function;
|
||||
static int proceed_next_node (const re_match_context_t *mctx,
|
||||
int nregs, regmatch_t *regs,
|
||||
int *pidx, int node, re_node_set *eps_via_nodes,
|
||||
struct re_fail_stack_t *fs) internal_function;
|
||||
static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs,
|
||||
int str_idx, int dest_node, int nregs,
|
||||
regmatch_t *regs,
|
||||
re_node_set *eps_via_nodes)
|
||||
internal_function;
|
||||
static int pop_fail_stack (struct re_fail_stack_t *fs, int *pidx, int nregs,
|
||||
regmatch_t *regs, re_node_set *eps_via_nodes)
|
||||
internal_function;
|
||||
static reg_errcode_t set_regs (const regex_t *preg,
|
||||
const re_match_context_t *mctx,
|
||||
size_t nmatch, regmatch_t *pmatch,
|
||||
@ -108,10 +96,6 @@ static reg_errcode_t add_epsilon_src_nodes (const re_dfa_t *dfa,
|
||||
re_node_set *dest_nodes,
|
||||
const re_node_set *candidates)
|
||||
internal_function;
|
||||
static reg_errcode_t sub_epsilon_src_nodes (const re_dfa_t *dfa, int node,
|
||||
re_node_set *dest_nodes,
|
||||
const re_node_set *and_nodes)
|
||||
internal_function;
|
||||
static int check_dst_limits (const re_match_context_t *mctx,
|
||||
re_node_set *limits,
|
||||
int dst_node, int dst_idx, int src_node,
|
||||
@ -134,9 +118,6 @@ static reg_errcode_t sift_states_bkref (const re_match_context_t *mctx,
|
||||
re_sift_context_t *sctx,
|
||||
int str_idx, const re_node_set *candidates)
|
||||
internal_function;
|
||||
static reg_errcode_t clean_state_log_if_needed (re_match_context_t *mctx,
|
||||
int next_state_log_idx)
|
||||
internal_function;
|
||||
static reg_errcode_t merge_state_array (const re_dfa_t *dfa,
|
||||
re_dfastate_t **dst,
|
||||
re_dfastate_t **src, int num)
|
||||
@ -1041,10 +1022,9 @@ prune_impossible_nodes (mctx)
|
||||
since initial states may have constraints like "\<", "^", etc.. */
|
||||
|
||||
static inline re_dfastate_t *
|
||||
acquire_init_state_context (err, mctx, idx)
|
||||
reg_errcode_t *err;
|
||||
const re_match_context_t *mctx;
|
||||
int idx;
|
||||
__attribute ((always_inline)) internal_function
|
||||
acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
|
||||
int idx)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
if (dfa->init_state->has_constraint)
|
||||
@ -1084,10 +1064,8 @@ acquire_init_state_context (err, mctx, idx)
|
||||
index of the buffer. */
|
||||
|
||||
static int
|
||||
check_matching (mctx, fl_longest_match, p_match_first)
|
||||
re_match_context_t *mctx;
|
||||
int fl_longest_match;
|
||||
int *p_match_first;
|
||||
check_matching (re_match_context_t *mctx, int fl_longest_match,
|
||||
int *p_match_first)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
reg_errcode_t err;
|
||||
@ -1216,10 +1194,9 @@ check_matching (mctx, fl_longest_match, p_match_first)
|
||||
|
||||
/* Check NODE match the current context. */
|
||||
|
||||
static int check_halt_node_context (dfa, node, context)
|
||||
const re_dfa_t *dfa;
|
||||
int node;
|
||||
unsigned int context;
|
||||
static int
|
||||
internal_function
|
||||
check_halt_node_context (const re_dfa_t *dfa, int node, unsigned int context)
|
||||
{
|
||||
re_token_type_t type = dfa->nodes[node].type;
|
||||
unsigned int constraint = dfa->nodes[node].constraint;
|
||||
@ -1237,10 +1214,8 @@ static int check_halt_node_context (dfa, node, context)
|
||||
match the context, return the node. */
|
||||
|
||||
static int
|
||||
check_halt_state_context (mctx, state, idx)
|
||||
const re_match_context_t *mctx;
|
||||
const re_dfastate_t *state;
|
||||
int idx;
|
||||
check_halt_state_context (const re_match_context_t *mctx,
|
||||
const re_dfastate_t *state, int idx)
|
||||
{
|
||||
int i;
|
||||
unsigned int context;
|
||||
@ -1260,12 +1235,10 @@ check_halt_state_context (mctx, state, idx)
|
||||
of errors. */
|
||||
|
||||
static int
|
||||
proceed_next_node (mctx, nregs, regs, pidx, node, eps_via_nodes, fs)
|
||||
const re_match_context_t *mctx;
|
||||
regmatch_t *regs;
|
||||
int nregs, *pidx, node;
|
||||
re_node_set *eps_via_nodes;
|
||||
struct re_fail_stack_t *fs;
|
||||
internal_function
|
||||
proceed_next_node (const re_match_context_t *mctx, int nregs, regmatch_t *regs,
|
||||
int *pidx, int node, re_node_set *eps_via_nodes,
|
||||
struct re_fail_stack_t *fs)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
int i, err;
|
||||
@ -1362,11 +1335,8 @@ proceed_next_node (mctx, nregs, regs, pidx, node, eps_via_nodes, fs)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
push_fail_stack (fs, str_idx, dest_node, nregs, regs, eps_via_nodes)
|
||||
struct re_fail_stack_t *fs;
|
||||
int str_idx, dest_node, nregs;
|
||||
regmatch_t *regs;
|
||||
re_node_set *eps_via_nodes;
|
||||
push_fail_stack (struct re_fail_stack_t *fs, int str_idx, int dest_node,
|
||||
int nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
|
||||
{
|
||||
reg_errcode_t err;
|
||||
int num = fs->num++;
|
||||
@ -1391,11 +1361,9 @@ push_fail_stack (fs, str_idx, dest_node, nregs, regs, eps_via_nodes)
|
||||
}
|
||||
|
||||
static int
|
||||
pop_fail_stack (fs, pidx, nregs, regs, eps_via_nodes)
|
||||
struct re_fail_stack_t *fs;
|
||||
int *pidx, nregs;
|
||||
regmatch_t *regs;
|
||||
re_node_set *eps_via_nodes;
|
||||
internal_function
|
||||
pop_fail_stack (struct re_fail_stack_t *fs, int *pidx, int nregs,
|
||||
regmatch_t *regs, re_node_set *eps_via_nodes)
|
||||
{
|
||||
int num = --fs->num;
|
||||
assert (num >= 0);
|
||||
@ -1413,12 +1381,8 @@ pop_fail_stack (fs, pidx, nregs, regs, eps_via_nodes)
|
||||
pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch. */
|
||||
|
||||
static reg_errcode_t
|
||||
set_regs (preg, mctx, nmatch, pmatch, fl_backtrack)
|
||||
const regex_t *preg;
|
||||
const re_match_context_t *mctx;
|
||||
size_t nmatch;
|
||||
regmatch_t *pmatch;
|
||||
int fl_backtrack;
|
||||
set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
|
||||
regmatch_t *pmatch, int fl_backtrack)
|
||||
{
|
||||
const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
|
||||
int idx, cur_node;
|
||||
@ -1523,8 +1487,7 @@ set_regs (preg, mctx, nmatch, pmatch, fl_backtrack)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
free_fail_stack_return (fs)
|
||||
struct re_fail_stack_t *fs;
|
||||
free_fail_stack_return (struct re_fail_stack_t *fs)
|
||||
{
|
||||
if (fs)
|
||||
{
|
||||
@ -1540,10 +1503,8 @@ free_fail_stack_return (fs)
|
||||
}
|
||||
|
||||
static void
|
||||
update_regs (dfa, pmatch, prev_idx_match, cur_node, cur_idx, nmatch)
|
||||
const re_dfa_t *dfa;
|
||||
regmatch_t *pmatch, *prev_idx_match;
|
||||
int cur_node, cur_idx, nmatch;
|
||||
update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
|
||||
regmatch_t *prev_idx_match, int cur_node, int cur_idx, int nmatch)
|
||||
{
|
||||
int type = dfa->nodes[cur_node].type;
|
||||
if (type == OP_OPEN_SUBEXP)
|
||||
@ -1613,9 +1574,7 @@ update_regs (dfa, pmatch, prev_idx_match, cur_node, cur_idx, nmatch)
|
||||
((state) != NULL && re_node_set_contains (&(state)->nodes, node))
|
||||
|
||||
static reg_errcode_t
|
||||
sift_states_backward (mctx, sctx)
|
||||
const re_match_context_t *mctx;
|
||||
re_sift_context_t *sctx;
|
||||
sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
|
||||
{
|
||||
reg_errcode_t err;
|
||||
int null_cnt = 0;
|
||||
@ -1672,11 +1631,8 @@ sift_states_backward (mctx, sctx)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
build_sifted_states (mctx, sctx, str_idx, cur_dest)
|
||||
const re_match_context_t *mctx;
|
||||
re_sift_context_t *sctx;
|
||||
int str_idx;
|
||||
re_node_set *cur_dest;
|
||||
build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx,
|
||||
int str_idx, re_node_set *cur_dest)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
const re_node_set *cur_src = &mctx->state_log[str_idx]->non_eps_nodes;
|
||||
@ -1736,9 +1692,8 @@ build_sifted_states (mctx, sctx, str_idx, cur_dest)
|
||||
/* Helper functions. */
|
||||
|
||||
static reg_errcode_t
|
||||
clean_state_log_if_needed (mctx, next_state_log_idx)
|
||||
re_match_context_t *mctx;
|
||||
int next_state_log_idx;
|
||||
internal_function
|
||||
clean_state_log_if_needed (re_match_context_t *mctx, int next_state_log_idx)
|
||||
{
|
||||
int top = mctx->state_log_top;
|
||||
|
||||
@ -1762,11 +1717,8 @@ clean_state_log_if_needed (mctx, next_state_log_idx)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
merge_state_array (dfa, dst, src, num)
|
||||
const re_dfa_t *dfa;
|
||||
re_dfastate_t **dst;
|
||||
re_dfastate_t **src;
|
||||
int num;
|
||||
merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst,
|
||||
re_dfastate_t **src, int num)
|
||||
{
|
||||
int st_idx;
|
||||
reg_errcode_t err;
|
||||
@ -1791,11 +1743,9 @@ merge_state_array (dfa, dst, src, num)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
update_cur_sifted_state (mctx, sctx, str_idx, dest_nodes)
|
||||
const re_match_context_t *mctx;
|
||||
re_sift_context_t *sctx;
|
||||
int str_idx;
|
||||
re_node_set *dest_nodes;
|
||||
update_cur_sifted_state (const re_match_context_t *mctx,
|
||||
re_sift_context_t *sctx, int str_idx,
|
||||
re_node_set *dest_nodes)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
reg_errcode_t err = REG_NOERROR;
|
||||
@ -1840,10 +1790,8 @@ update_cur_sifted_state (mctx, sctx, str_idx, dest_nodes)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
add_epsilon_src_nodes (dfa, dest_nodes, candidates)
|
||||
const re_dfa_t *dfa;
|
||||
re_node_set *dest_nodes;
|
||||
const re_node_set *candidates;
|
||||
add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
|
||||
const re_node_set *candidates)
|
||||
{
|
||||
reg_errcode_t err = REG_NOERROR;
|
||||
int i;
|
||||
@ -1866,11 +1814,9 @@ add_epsilon_src_nodes (dfa, dest_nodes, candidates)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
sub_epsilon_src_nodes (dfa, node, dest_nodes, candidates)
|
||||
const re_dfa_t *dfa;
|
||||
int node;
|
||||
re_node_set *dest_nodes;
|
||||
const re_node_set *candidates;
|
||||
internal_function
|
||||
sub_epsilon_src_nodes (const re_dfa_t *dfa, int node, re_node_set *dest_nodes,
|
||||
const re_node_set *candidates)
|
||||
{
|
||||
int ecl_idx;
|
||||
reg_errcode_t err;
|
||||
@ -1917,10 +1863,8 @@ sub_epsilon_src_nodes (dfa, node, dest_nodes, candidates)
|
||||
}
|
||||
|
||||
static int
|
||||
check_dst_limits (mctx, limits, dst_node, dst_idx, src_node, src_idx)
|
||||
const re_match_context_t *mctx;
|
||||
re_node_set *limits;
|
||||
int dst_node, dst_idx, src_node, src_idx;
|
||||
check_dst_limits (const re_match_context_t *mctx, re_node_set *limits,
|
||||
int dst_node, int dst_idx, int src_node, int src_idx)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
int lim_idx, src_pos, dst_pos;
|
||||
@ -1954,9 +1898,8 @@ check_dst_limits (mctx, limits, dst_node, dst_idx, src_node, src_idx)
|
||||
}
|
||||
|
||||
static int
|
||||
check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx, from_node, bkref_idx)
|
||||
const re_match_context_t *mctx;
|
||||
int boundaries, subexp_idx, from_node, bkref_idx;
|
||||
check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
|
||||
int subexp_idx, int from_node, int bkref_idx)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
const re_node_set *eclosures = dfa->eclosures + from_node;
|
||||
@ -2035,9 +1978,9 @@ check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx, from_node, bkref_idx)
|
||||
}
|
||||
|
||||
static int
|
||||
check_dst_limits_calc_pos (mctx, limit, subexp_idx, from_node, str_idx, bkref_idx)
|
||||
const re_match_context_t *mctx;
|
||||
int limit, subexp_idx, from_node, str_idx, bkref_idx;
|
||||
check_dst_limits_calc_pos (const re_match_context_t *mctx, int limit,
|
||||
int subexp_idx, int from_node, int str_idx,
|
||||
int bkref_idx)
|
||||
{
|
||||
struct re_backref_cache_entry *lim = mctx->bkref_ents + limit;
|
||||
int boundaries;
|
||||
@ -2064,13 +2007,9 @@ check_dst_limits_calc_pos (mctx, limit, subexp_idx, from_node, str_idx, bkref_id
|
||||
which are against limitations from DEST_NODES. */
|
||||
|
||||
static reg_errcode_t
|
||||
check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx)
|
||||
const re_dfa_t *dfa;
|
||||
re_node_set *dest_nodes;
|
||||
const re_node_set *candidates;
|
||||
re_node_set *limits;
|
||||
struct re_backref_cache_entry *bkref_ents;
|
||||
int str_idx;
|
||||
check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes,
|
||||
const re_node_set *candidates, re_node_set *limits,
|
||||
struct re_backref_cache_entry *bkref_ents, int str_idx)
|
||||
{
|
||||
reg_errcode_t err;
|
||||
int node_idx, lim_idx;
|
||||
@ -2155,11 +2094,8 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx)
|
||||
}
|
||||
|
||||
static reg_errcode_t
|
||||
sift_states_bkref (mctx, sctx, str_idx, candidates)
|
||||
const re_match_context_t *mctx;
|
||||
re_sift_context_t *sctx;
|
||||
int str_idx;
|
||||
const re_node_set *candidates;
|
||||
sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
|
||||
int str_idx, const re_node_set *candidates)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
reg_errcode_t err;
|
||||
@ -2257,10 +2193,8 @@ sift_states_bkref (mctx, sctx, str_idx, candidates)
|
||||
|
||||
#ifdef RE_ENABLE_I18N
|
||||
static int
|
||||
sift_states_iter_mb (mctx, sctx, node_idx, str_idx, max_str_idx)
|
||||
const re_match_context_t *mctx;
|
||||
re_sift_context_t *sctx;
|
||||
int node_idx, str_idx, max_str_idx;
|
||||
sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
|
||||
int node_idx, int str_idx, int max_str_idx)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
int naccepted;
|
||||
@ -2288,10 +2222,8 @@ sift_states_iter_mb (mctx, sctx, node_idx, str_idx, max_str_idx)
|
||||
update the destination of STATE_LOG. */
|
||||
|
||||
static re_dfastate_t *
|
||||
transit_state (err, mctx, state)
|
||||
reg_errcode_t *err;
|
||||
re_match_context_t *mctx;
|
||||
re_dfastate_t *state;
|
||||
transit_state (reg_errcode_t *err, re_match_context_t *mctx,
|
||||
re_dfastate_t *state)
|
||||
{
|
||||
re_dfastate_t **trtable;
|
||||
unsigned char ch;
|
||||
@ -2347,10 +2279,8 @@ transit_state (err, mctx, state)
|
||||
|
||||
/* Update the state_log if we need */
|
||||
re_dfastate_t *
|
||||
merge_state_with_log (err, mctx, next_state)
|
||||
reg_errcode_t *err;
|
||||
re_match_context_t *mctx;
|
||||
re_dfastate_t *next_state;
|
||||
merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
|
||||
re_dfastate_t *next_state)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
int cur_idx = re_string_cur_idx (&mctx->input);
|
||||
@ -2427,9 +2357,7 @@ merge_state_with_log (err, mctx, next_state)
|
||||
multi-byte match, then look in the log for a state
|
||||
from which to restart matching. */
|
||||
re_dfastate_t *
|
||||
find_recover_state (err, mctx)
|
||||
reg_errcode_t *err;
|
||||
re_match_context_t *mctx;
|
||||
find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
|
||||
{
|
||||
re_dfastate_t *cur_state;
|
||||
do
|
||||
@ -2459,10 +2387,8 @@ find_recover_state (err, mctx)
|
||||
correspoding back references. */
|
||||
|
||||
static reg_errcode_t
|
||||
check_subexp_matching_top (mctx, cur_nodes, str_idx)
|
||||
re_match_context_t *mctx;
|
||||
re_node_set *cur_nodes;
|
||||
int str_idx;
|
||||
check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes,
|
||||
int str_idx)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
int node_idx;
|
||||
@ -2494,10 +2420,8 @@ check_subexp_matching_top (mctx, cur_nodes, str_idx)
|
||||
accepting the current input byte. */
|
||||
|
||||
static re_dfastate_t *
|
||||
transit_state_sb (err, mctx, state)
|
||||
reg_errcode_t *err;
|
||||
re_match_context_t *mctx;
|
||||
re_dfastate_t *state;
|
||||
transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx,
|
||||
re_dfastate_t *state)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
re_node_set next_nodes;
|
||||
@ -2535,9 +2459,7 @@ transit_state_sb (err, mctx, state)
|
||||
|
||||
#ifdef RE_ENABLE_I18N
|
||||
static reg_errcode_t
|
||||
transit_state_mb (mctx, pstate)
|
||||
re_match_context_t *mctx;
|
||||
re_dfastate_t *pstate;
|
||||
transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
reg_errcode_t err;
|
||||
@ -2606,9 +2528,7 @@ transit_state_mb (mctx, pstate)
|
||||
#endif /* RE_ENABLE_I18N */
|
||||
|
||||
static reg_errcode_t
|
||||
transit_state_bkref (mctx, nodes)
|
||||
re_match_context_t *mctx;
|
||||
const re_node_set *nodes;
|
||||
transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
reg_errcode_t err;
|
||||
@ -2721,9 +2641,7 @@ transit_state_bkref (mctx, nodes)
|
||||
delay these checking for prune_impossible_nodes(). */
|
||||
|
||||
static reg_errcode_t
|
||||
get_subexp (mctx, bkref_node, bkref_str_idx)
|
||||
re_match_context_t *mctx;
|
||||
int bkref_node, bkref_str_idx;
|
||||
get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
int subexp_num, sub_top_idx;
|
||||
@ -2871,11 +2789,8 @@ get_subexp (mctx, bkref_node, bkref_str_idx)
|
||||
and SUB_LAST. */
|
||||
|
||||
static reg_errcode_t
|
||||
get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str)
|
||||
re_match_context_t *mctx;
|
||||
const re_sub_match_top_t *sub_top;
|
||||
re_sub_match_last_t *sub_last;
|
||||
int bkref_node, bkref_str;
|
||||
get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top,
|
||||
re_sub_match_last_t *sub_last, int bkref_node, int bkref_str)
|
||||
{
|
||||
reg_errcode_t err;
|
||||
int to_idx;
|
||||
@ -2902,10 +2817,8 @@ get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str)
|
||||
E.g. RE: (a){2} */
|
||||
|
||||
static int
|
||||
find_subexp_node (dfa, nodes, subexp_idx, type)
|
||||
const re_dfa_t *dfa;
|
||||
const re_node_set *nodes;
|
||||
int subexp_idx, type;
|
||||
find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
|
||||
int subexp_idx, int type)
|
||||
{
|
||||
int cls_idx;
|
||||
for (cls_idx = 0; cls_idx < nodes->nelem; ++cls_idx)
|
||||
@ -2925,11 +2838,8 @@ find_subexp_node (dfa, nodes, subexp_idx, type)
|
||||
Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise. */
|
||||
|
||||
static reg_errcode_t
|
||||
check_arrival (mctx, path, top_node, top_str, last_node, last_str,
|
||||
type)
|
||||
re_match_context_t *mctx;
|
||||
state_array_t *path;
|
||||
int top_node, top_str, last_node, last_str, type;
|
||||
check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node,
|
||||
int top_str, int last_node, int last_str, int type)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
reg_errcode_t err = REG_NOERROR;
|
||||
@ -3088,10 +2998,8 @@ check_arrival (mctx, path, top_node, top_str, last_node, last_str,
|
||||
Can't we unify them? */
|
||||
|
||||
static reg_errcode_t
|
||||
check_arrival_add_next_nodes (mctx, str_idx, cur_nodes, next_nodes)
|
||||
re_match_context_t *mctx;
|
||||
int str_idx;
|
||||
re_node_set *cur_nodes, *next_nodes;
|
||||
check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx,
|
||||
re_node_set *cur_nodes, re_node_set *next_nodes)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
int result;
|
||||
@ -3168,10 +3076,8 @@ check_arrival_add_next_nodes (mctx, str_idx, cur_nodes, next_nodes)
|
||||
*/
|
||||
|
||||
static reg_errcode_t
|
||||
check_arrival_expand_ecl (dfa, cur_nodes, ex_subexp, type)
|
||||
const re_dfa_t *dfa;
|
||||
re_node_set *cur_nodes;
|
||||
int ex_subexp, type;
|
||||
check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes,
|
||||
int ex_subexp, int type)
|
||||
{
|
||||
reg_errcode_t err;
|
||||
int idx, outside_node;
|
||||
@ -3222,10 +3128,8 @@ check_arrival_expand_ecl (dfa, cur_nodes, ex_subexp, type)
|
||||
problematic append it to DST_NODES. */
|
||||
|
||||
static reg_errcode_t
|
||||
check_arrival_expand_ecl_sub (dfa, dst_nodes, target, ex_subexp, type)
|
||||
const re_dfa_t *dfa;
|
||||
int target, ex_subexp, type;
|
||||
re_node_set *dst_nodes;
|
||||
check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
|
||||
int target, int ex_subexp, int type)
|
||||
{
|
||||
int cur_node;
|
||||
for (cur_node = target; !re_node_set_contains (dst_nodes, cur_node);)
|
||||
@ -3267,11 +3171,8 @@ check_arrival_expand_ecl_sub (dfa, dst_nodes, target, ex_subexp, type)
|
||||
in MCTX->BKREF_ENTS. */
|
||||
|
||||
static reg_errcode_t
|
||||
expand_bkref_cache (mctx, cur_nodes, cur_str, subexp_num,
|
||||
type)
|
||||
re_match_context_t *mctx;
|
||||
int cur_str, subexp_num, type;
|
||||
re_node_set *cur_nodes;
|
||||
expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes,
|
||||
int cur_str, int subexp_num, int type)
|
||||
{
|
||||
const re_dfa_t *const dfa = mctx->dfa;
|
||||
reg_errcode_t err;
|
||||
@ -3358,9 +3259,7 @@ expand_bkref_cache (mctx, cur_nodes, cur_str, subexp_num,
|
||||
Return 1 if succeeded, otherwise return NULL. */
|
||||
|
||||
static int
|
||||
build_trtable (dfa, state)
|
||||
const re_dfa_t *dfa;
|
||||
re_dfastate_t *state;
|
||||
build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
|
||||
{
|
||||
reg_errcode_t err;
|
||||
int i, j, ch, need_word_trtable = 0;
|
||||
@ -3586,11 +3485,8 @@ out_free:
|
||||
to DEST_CH[i]. This function return the number of destinations. */
|
||||
|
||||
static int
|
||||
group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch)
|
||||
const re_dfa_t *dfa;
|
||||
const re_dfastate_t *state;
|
||||
re_node_set *dests_node;
|
||||
bitset_t *dests_ch;
|
||||
group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
|
||||
re_node_set *dests_node, bitset_t *dests_ch)
|
||||
{
|
||||
reg_errcode_t err;
|
||||
int result;
|
||||
@ -3778,10 +3674,8 @@ group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch)
|
||||
can only accept one byte. */
|
||||
|
||||
static int
|
||||
check_node_accept_bytes (dfa, node_idx, input, str_idx)
|
||||
const re_dfa_t *dfa;
|
||||
int node_idx, str_idx;
|
||||
const re_string_t *input;
|
||||
check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
|
||||
const re_string_t *input, int str_idx)
|
||||
{
|
||||
const re_token_t *node = dfa->nodes + node_idx;
|
||||
int char_len, elem_len;
|
||||
@ -4015,9 +3909,7 @@ check_node_accept_bytes (dfa, node_idx, input, str_idx)
|
||||
|
||||
# ifdef _LIBC
|
||||
static unsigned int
|
||||
find_collation_sequence_value (mbs, mbs_len)
|
||||
const unsigned char *mbs;
|
||||
size_t mbs_len;
|
||||
find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
|
||||
{
|
||||
uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
|
||||
if (nrules == 0)
|
||||
@ -4079,10 +3971,8 @@ find_collation_sequence_value (mbs, mbs_len)
|
||||
byte of the INPUT. */
|
||||
|
||||
static int
|
||||
check_node_accept (mctx, node, idx)
|
||||
const re_match_context_t *mctx;
|
||||
const re_token_t *node;
|
||||
int idx;
|
||||
check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
|
||||
int idx)
|
||||
{
|
||||
unsigned char ch;
|
||||
ch = re_string_byte_at (&mctx->input, idx);
|
||||
@ -4130,8 +4020,7 @@ check_node_accept (mctx, node, idx)
|
||||
/* Extend the buffers, if the buffers have run out. */
|
||||
|
||||
static reg_errcode_t
|
||||
extend_buffers (mctx)
|
||||
re_match_context_t *mctx;
|
||||
extend_buffers (re_match_context_t *mctx)
|
||||
{
|
||||
reg_errcode_t ret;
|
||||
re_string_t *pstr = &mctx->input;
|
||||
@ -4189,9 +4078,7 @@ extend_buffers (mctx)
|
||||
/* Initialize MCTX. */
|
||||
|
||||
static reg_errcode_t
|
||||
match_ctx_init (mctx, eflags, n)
|
||||
re_match_context_t *mctx;
|
||||
int eflags, n;
|
||||
match_ctx_init (re_match_context_t *mctx, int eflags, int n)
|
||||
{
|
||||
mctx->eflags = eflags;
|
||||
mctx->match_last = -1;
|
||||
@ -4218,8 +4105,7 @@ match_ctx_init (mctx, eflags, n)
|
||||
of the input, or changes the input string. */
|
||||
|
||||
static void
|
||||
match_ctx_clean (mctx)
|
||||
re_match_context_t *mctx;
|
||||
match_ctx_clean (re_match_context_t *mctx)
|
||||
{
|
||||
int st_idx;
|
||||
for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx)
|
||||
@ -4248,8 +4134,7 @@ match_ctx_clean (mctx)
|
||||
/* Free all the memory associated with MCTX. */
|
||||
|
||||
static void
|
||||
match_ctx_free (mctx)
|
||||
re_match_context_t *mctx;
|
||||
match_ctx_free (re_match_context_t *mctx)
|
||||
{
|
||||
/* First, free all the memory associated with MCTX->SUB_TOPS. */
|
||||
match_ctx_clean (mctx);
|
||||
@ -4263,9 +4148,8 @@ match_ctx_free (mctx)
|
||||
*/
|
||||
|
||||
static reg_errcode_t
|
||||
match_ctx_add_entry (mctx, node, str_idx, from, to)
|
||||
re_match_context_t *mctx;
|
||||
int node, str_idx, from, to;
|
||||
match_ctx_add_entry (re_match_context_t *mctx, int node, int str_idx, int from,
|
||||
int to)
|
||||
{
|
||||
if (mctx->nbkref_ents >= mctx->abkref_ents)
|
||||
{
|
||||
@ -4312,9 +4196,7 @@ match_ctx_add_entry (mctx, node, str_idx, from, to)
|
||||
found. Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX. */
|
||||
|
||||
static int
|
||||
search_cur_bkref_entry (mctx, str_idx)
|
||||
const re_match_context_t *mctx;
|
||||
int str_idx;
|
||||
search_cur_bkref_entry (const re_match_context_t *mctx, int str_idx)
|
||||
{
|
||||
int left, right, mid, last;
|
||||
last = right = mctx->nbkref_ents;
|
||||
@ -4336,9 +4218,7 @@ search_cur_bkref_entry (mctx, str_idx)
|
||||
at STR_IDX. */
|
||||
|
||||
static reg_errcode_t
|
||||
match_ctx_add_subtop (mctx, node, str_idx)
|
||||
re_match_context_t *mctx;
|
||||
int node, str_idx;
|
||||
match_ctx_add_subtop (re_match_context_t *mctx, int node, int str_idx)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
assert (mctx->sub_tops != NULL);
|
||||
@ -4367,9 +4247,7 @@ match_ctx_add_subtop (mctx, node, str_idx)
|
||||
at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP. */
|
||||
|
||||
static re_sub_match_last_t *
|
||||
match_ctx_add_sublast (subtop, node, str_idx)
|
||||
re_sub_match_top_t *subtop;
|
||||
int node, str_idx;
|
||||
match_ctx_add_sublast (re_sub_match_top_t *subtop, int node, int str_idx)
|
||||
{
|
||||
re_sub_match_last_t *new_entry;
|
||||
if (BE (subtop->nlasts == subtop->alasts, 0))
|
||||
@ -4395,10 +4273,8 @@ match_ctx_add_sublast (subtop, node, str_idx)
|
||||
}
|
||||
|
||||
static void
|
||||
sift_ctx_init (sctx, sifted_sts, limited_sts, last_node, last_str_idx)
|
||||
re_sift_context_t *sctx;
|
||||
re_dfastate_t **sifted_sts, **limited_sts;
|
||||
int last_node, last_str_idx;
|
||||
sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts,
|
||||
re_dfastate_t **limited_sts, int last_node, int last_str_idx)
|
||||
{
|
||||
sctx->sifted_states = sifted_sts;
|
||||
sctx->limited_states = limited_sts;
|
||||
|
Loading…
Reference in New Issue
Block a user