diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/regcomp.c | 2 | ||||
-rw-r--r-- | posix/regex_internal.c | 22 | ||||
-rw-r--r-- | posix/regex_internal.h | 69 | ||||
-rw-r--r-- | posix/tst-rxspencer.c | 2 |
4 files changed, 53 insertions, 42 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c index f44c3f3283..1a7e5192cf 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -2968,6 +2968,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) #endif /* not RE_ENABLE_I18N */ bin_tree_t *work_tree; int token_len; + int first_round = 1; #ifdef _LIBC collseqmb = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB); @@ -3027,7 +3028,6 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) if (token->type == OP_CLOSE_BRACKET) token->type = CHARACTER; - int first_round = 1; while (1) { bracket_elem_t start_elem, end_elem; diff --git a/posix/regex_internal.c b/posix/regex_internal.c index ed377eb6dc..45b45aaaf0 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -21,25 +21,25 @@ 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); + 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); + wint_t *last_wc) internal_function; #endif /* RE_ENABLE_I18N */ static re_dfastate_t *create_newstate_common (re_dfa_t *dfa, const re_node_set *nodes, - unsigned int hash); + unsigned int hash) internal_function; static reg_errcode_t register_state (re_dfa_t *dfa, re_dfastate_t *newstate, - unsigned int hash); + unsigned int hash) internal_function; static re_dfastate_t *create_ci_newstate (re_dfa_t *dfa, const re_node_set *nodes, - unsigned int hash); + unsigned int hash) internal_function; static re_dfastate_t *create_cd_newstate (re_dfa_t *dfa, const re_node_set *nodes, unsigned int context, - unsigned int hash); + unsigned int hash) internal_function; static unsigned int inline calc_state_hash (const re_node_set *nodes, - unsigned int context); + unsigned int context) internal_function; /* Functions for string operation. */ @@ -746,8 +746,9 @@ re_string_reconstruct (pstr, idx, eflags, newline) } static unsigned char -re_string_peek_byte_case (const re_string_t *pstr, - int idx) +re_string_peek_byte_case (pstr, idx) + const re_string_t *pstr; + int idx; { int ch, off; @@ -784,7 +785,8 @@ re_string_peek_byte_case (const re_string_t *pstr, } static unsigned char -re_string_fetch_byte_case (re_string_t *pstr) +re_string_fetch_byte_case (pstr) + re_string_t *pstr; { int ch; diff --git a/posix/regex_internal.h b/posix/regex_internal.h index ea9a30c16e..8f11ba7a44 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -349,35 +349,44 @@ typedef struct re_string_t re_string_t; struct re_dfa_t; typedef struct re_dfa_t re_dfa_t; + +#ifndef _LIBC +# ifdef __i386__ +# define internal_function __attribute ((regparm (3), stdcall)) +# else +# define internal_function +# endif +#endif + #ifndef RE_NO_INTERNAL_PROTOTYPES static reg_errcode_t 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); + const re_dfa_t *dfa) internal_function; static reg_errcode_t re_string_construct (re_string_t *pstr, const char *str, int len, RE_TRANSLATE_TYPE trans, - int icase, const re_dfa_t *dfa); + int icase, const re_dfa_t *dfa) internal_function; static reg_errcode_t re_string_reconstruct (re_string_t *pstr, int idx, - int eflags, int newline); + int eflags, int newline) internal_function; static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, - int new_buf_len); + int new_buf_len) internal_function; # ifdef RE_ENABLE_I18N -static void build_wcs_buffer (re_string_t *pstr); -static int build_wcs_upper_buffer (re_string_t *pstr); +static void build_wcs_buffer (re_string_t *pstr) internal_function; +static int build_wcs_upper_buffer (re_string_t *pstr) internal_function; # endif /* RE_ENABLE_I18N */ -static void build_upper_buffer (re_string_t *pstr); -static void re_string_translate_buffer (re_string_t *pstr); -static void re_string_destruct (re_string_t *pstr); +static void build_upper_buffer (re_string_t *pstr) internal_function; +static void re_string_translate_buffer (re_string_t *pstr) internal_function; +static void re_string_destruct (re_string_t *pstr) internal_function; # ifdef RE_ENABLE_I18N -static int re_string_elem_size_at (const re_string_t *pstr, int idx); -static inline int re_string_char_size_at (const re_string_t *pstr, int idx); -static inline wint_t re_string_wchar_at (const re_string_t *pstr, int idx); +static int re_string_elem_size_at (const re_string_t *pstr, int idx) internal_function; +static inline int re_string_char_size_at (const re_string_t *pstr, int idx) internal_function; +static inline wint_t re_string_wchar_at (const re_string_t *pstr, int idx) internal_function; # endif /* RE_ENABLE_I18N */ static unsigned int re_string_context_at (const re_string_t *input, int idx, - int eflags, int newline_anchor); + int eflags, int newline_anchor) internal_function; static unsigned char re_string_peek_byte_case (const re_string_t *pstr, - int idx); -static unsigned char re_string_fetch_byte_case (re_string_t *pstr); + int idx) internal_function; +static unsigned char re_string_fetch_byte_case (re_string_t *pstr) internal_function; #endif #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) @@ -629,38 +638,38 @@ struct re_dfa_t }; #ifndef RE_NO_INTERNAL_PROTOTYPES -static reg_errcode_t re_node_set_alloc (re_node_set *set, int size); -static reg_errcode_t re_node_set_init_1 (re_node_set *set, int elem); +static reg_errcode_t re_node_set_alloc (re_node_set *set, int size) internal_function; +static reg_errcode_t re_node_set_init_1 (re_node_set *set, int elem) internal_function; static reg_errcode_t re_node_set_init_2 (re_node_set *set, int elem1, - int elem2); + int elem2) internal_function; #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set)) static reg_errcode_t re_node_set_init_copy (re_node_set *dest, - const re_node_set *src); + const re_node_set *src) internal_function; static reg_errcode_t re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, - const re_node_set *src2); + const re_node_set *src2) internal_function; static reg_errcode_t re_node_set_init_union (re_node_set *dest, const re_node_set *src1, - const re_node_set *src2); + const re_node_set *src2) internal_function; static reg_errcode_t re_node_set_merge (re_node_set *dest, - const re_node_set *src); -static int re_node_set_insert (re_node_set *set, int elem); + const re_node_set *src) internal_function; +static int re_node_set_insert (re_node_set *set, int elem) internal_function; static int re_node_set_compare (const re_node_set *set1, - const re_node_set *set2); -static int re_node_set_contains (const re_node_set *set, int elem); -static void re_node_set_remove_at (re_node_set *set, int idx); + const re_node_set *set2) internal_function; +static int re_node_set_contains (const re_node_set *set, int elem) internal_function; +static void re_node_set_remove_at (re_node_set *set, int idx) internal_function; #define re_node_set_remove(set,id) \ (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1)) #define re_node_set_empty(p) ((p)->nelem = 0) #define re_node_set_free(set) re_free ((set)->elems) -static int re_dfa_add_node (re_dfa_t *dfa, re_token_t token, int mode); +static int re_dfa_add_node (re_dfa_t *dfa, re_token_t token, int mode) internal_function; static re_dfastate_t *re_acquire_state (reg_errcode_t *err, re_dfa_t *dfa, - const re_node_set *nodes); + const re_node_set *nodes) internal_function; static re_dfastate_t *re_acquire_state_context (reg_errcode_t *err, re_dfa_t *dfa, const re_node_set *nodes, - unsigned int context); -static void free_state (re_dfastate_t *state); + unsigned int context) internal_function; +static void free_state (re_dfastate_t *state) internal_function; #endif diff --git a/posix/tst-rxspencer.c b/posix/tst-rxspencer.c index e9a61ea375..cb40421797 100644 --- a/posix/tst-rxspencer.c +++ b/posix/tst-rxspencer.c @@ -214,6 +214,7 @@ test (const char *pattern, int cflags, const char *string, int eflags, n = regcomp (&re, pattern, cflags); if (n != 0) { + char buf[500]; if (eflags == -1) { static struct { reg_errcode_t code; const char *name; } codes [] @@ -239,7 +240,6 @@ test (const char *pattern, int cflags, const char *string, int eflags, return 1; } - char buf[500]; regerror (n, &re, buf, sizeof (buf)); printf ("%s regcomp failed: %s\n", fail, buf); return 1; |