* config/srclist.txt: Add glibc bugs 1220, 1221, 1222.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 20 Aug 2005 07:42:15 +0000 (07:42 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 20 Aug 2005 07:42:15 +0000 (07:42 +0000)
* lib/regcomp.c:
(re_compile_pattern, re_set_syntax, re_compile_fastmap):
(re_compile_fastmap_iter, regcomp, regerror, regfree):
(re_compile_internal, init_dfa, init_word_char, free_workarea_compile):
(create_initial_state, optimize_utf8, analyze, postorder, preorder):
(optimize_subexps, lower_subexps, lower_subexp, calc_first, calc_next):
(link_nfa_nodes, duplicate_node_closure, search_duplicated_node):
(duplicate_node, calc_inveclosure, calc_eclosure, calc_eclosure_iter):
(fetch_token, peek_token, peek_token_bracket, parse, parse_reg_exp):
(parse_branch, parse_expression, parse_sub_exp, parse_dup_op):
(build_range_exp, build_collating_symbol, parse_bracket_exp):
(parse_bracket_element, parse_bracket_symbol, build_equiv_class):
(build_charclass, build_charclass_op, fetch_number, create_tree):
(create_token_tree, mark_opt_subexp, duplicate_tree):
Use prototypes rather than old-style definitions.
* lib/regex_internal.c:
(re_string_allocate, re_string_construct, re_string_realloc_buffers):
(re_string_construct_common, build_wcs_buffer, build_wcs_upper_buffer):
(re_string_skip_chars, build_upper_buffer, re_string_translate_buffer):
(re_string_reconstruct, re_string_peek_byte_case):
(re_string_fetch_byte_case, re_string_destruct, re_string_context_at):
(re_node_set_alloc, re_node_set_init_1, re_node_set_init_2):
(re_node_set_init_copy, re_node_set_add_intersect):
(re_node_set_init_union, re_node_set_merge, re_node_set_insert):
(re_node_set_insert_last, re_node_set_compare, re_node_set_contains):
(re_node_set_remove_at, re_dfa_add_node, calc_state_hash):
(re_acquire_state, re_acquire_state_context, register_state):
(create_ci_newstate, create_cd_newstate, free_state):
Likewise.
* lib/regexec.c (regexec, re_match, re_search, re_match_2, re_search_2):
(re_search_2_stub, re_search_stub, re_copy_regs, re_set_registers):
(re_search_internal, prune_impossible_nodes):
(acquire_init_state_context, check_matching, static):
(check_halt_node_context, check_halt_state_context, proceed_next_node):
(push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return):
(update_regs, sift_states_backward, build_sifted_states):
(clean_state_log_if_needed, merge_state_array):
(update_cur_sifted_state, add_epsilon_src_nodes):
(sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos_1):
(check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref):
(sift_states_iter_mb, transit_state, merge_state_with_log, static):
(find_recover_state, check_subexp_matching_top, transit_state_mb):
(transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node):
(check_arrival, check_arrival_add_next_nodes):
(check_arrival_expand_ecl, check_arrival_expand_ecl_sub):
(expand_bkref_cache, build_trtable, group_nodes_into_DFAstates):
(check_node_accept_bytes, check_node_accept, extend_buffers):
(match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_add_entry):
(search_cur_bkref_entry, match_ctx_add_subtop, match_ctx_add_sublast):
(sift_ctx_init):
Likewise.

* lib/regex_internal.h:
(re_string_allocate, re_string_construct, re_string_reconstruct):
(re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer):
(build_upper_buffer, re_string_translate_buffer, re_string_destruct):
(re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at):
(re_string_context_at, re_string_peek_byte_case):
(re_string_fetch_byte_case): Declare even if RE_NO_INTERNAL_PROTOTYPES
is defined, since we now use prototypes always.

* lib/regex.h (_RE_ARGS): Remove.  No longer needed, since we assume
C89 or better.  All uses removed.

config/ChangeLog
config/srclist.txt
lib/ChangeLog
lib/regcomp.c
lib/regex.h
lib/regex_internal.c
lib/regex_internal.h
lib/regexec.c

index 61bee05..6eebce9 100644 (file)
@@ -1,3 +1,7 @@
+2005-08-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * srclist.txt: Add glibc bugs 1220, 1221, 1222.
+
 2005-08-19  Paul Eggert  <eggert@cs.ucla.edu>
 
        * srclist.txt: Comment out $LIBCSRC/posix/regex_internal.c,
index b1f7ccd..3b9bd00 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: srclist.txt,v 1.72 2005-08-20 01:03:17 eggert Exp $
+# $Id: srclist.txt,v 1.73 2005-08-20 07:42:15 eggert Exp $
 # Files for which we are not the source.  See ./srclistvars.sh for the
 # variable definitions.
 
@@ -96,22 +96,27 @@ $LIBCSRC/stdlib/getsubopt.c         lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1057
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1217
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1220
 #$LIBCSRC/posix/regcomp.c              lib gpl
 #
 $LIBCSRC/posix/regex.c                 lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1201
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1207
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1222
 #$LIBCSRC/posix/regex.h                        lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1215
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1218
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1220
 #$LIBCSRC/posix/regex_internal.c               lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1054
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1221
 #$LIBCSRC/posix/regex_internal.h               lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1216
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1220
 #$LIBCSRC/posix/regexec.c              lib gpl
 #
 # c89 changes $LIBCSRC/string/strdup.c         lib gpl
index eac25c4..2dca012 100644 (file)
@@ -1,3 +1,69 @@
+2005-08-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * regcomp.c:
+       (re_compile_pattern, re_set_syntax, re_compile_fastmap):
+       (re_compile_fastmap_iter, regcomp, regerror, regfree):
+       (re_compile_internal, init_dfa, init_word_char, free_workarea_compile):
+       (create_initial_state, optimize_utf8, analyze, postorder, preorder):
+       (optimize_subexps, lower_subexps, lower_subexp, calc_first, calc_next):
+       (link_nfa_nodes, duplicate_node_closure, search_duplicated_node):
+       (duplicate_node, calc_inveclosure, calc_eclosure, calc_eclosure_iter):
+       (fetch_token, peek_token, peek_token_bracket, parse, parse_reg_exp):
+       (parse_branch, parse_expression, parse_sub_exp, parse_dup_op):
+       (build_range_exp, build_collating_symbol, parse_bracket_exp):
+       (parse_bracket_element, parse_bracket_symbol, build_equiv_class):
+       (build_charclass, build_charclass_op, fetch_number, create_tree):
+       (create_token_tree, mark_opt_subexp, duplicate_tree):
+       Use prototypes rather than old-style definitions.
+       * regex_internal.c:
+       (re_string_allocate, re_string_construct, re_string_realloc_buffers):
+       (re_string_construct_common, build_wcs_buffer, build_wcs_upper_buffer):
+       (re_string_skip_chars, build_upper_buffer, re_string_translate_buffer):
+       (re_string_reconstruct, re_string_peek_byte_case):
+       (re_string_fetch_byte_case, re_string_destruct, re_string_context_at):
+       (re_node_set_alloc, re_node_set_init_1, re_node_set_init_2):
+       (re_node_set_init_copy, re_node_set_add_intersect):
+       (re_node_set_init_union, re_node_set_merge, re_node_set_insert):
+       (re_node_set_insert_last, re_node_set_compare, re_node_set_contains):
+       (re_node_set_remove_at, re_dfa_add_node, calc_state_hash):
+       (re_acquire_state, re_acquire_state_context, register_state):
+       (create_ci_newstate, create_cd_newstate, free_state):
+       Likewise.
+       * regexec.c (regexec, re_match, re_search, re_match_2, re_search_2):
+       (re_search_2_stub, re_search_stub, re_copy_regs, re_set_registers):
+       (re_search_internal, prune_impossible_nodes):
+       (acquire_init_state_context, check_matching, static):
+       (check_halt_node_context, check_halt_state_context, proceed_next_node):
+       (push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return):
+       (update_regs, sift_states_backward, build_sifted_states):
+       (clean_state_log_if_needed, merge_state_array):
+       (update_cur_sifted_state, add_epsilon_src_nodes):
+       (sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos_1):
+       (check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref):
+       (sift_states_iter_mb, transit_state, merge_state_with_log, static):
+       (find_recover_state, check_subexp_matching_top, transit_state_mb):
+       (transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node):
+       (check_arrival, check_arrival_add_next_nodes):
+       (check_arrival_expand_ecl, check_arrival_expand_ecl_sub):
+       (expand_bkref_cache, build_trtable, group_nodes_into_DFAstates):
+       (check_node_accept_bytes, check_node_accept, extend_buffers):
+       (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_add_entry):
+       (search_cur_bkref_entry, match_ctx_add_subtop, match_ctx_add_sublast):
+       (sift_ctx_init):
+       Likewise.
+
+       * regex_internal.h:
+       (re_string_allocate, re_string_construct, re_string_reconstruct):
+       (re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer):
+       (build_upper_buffer, re_string_translate_buffer, re_string_destruct):
+       (re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at):
+       (re_string_context_at, re_string_peek_byte_case):
+       (re_string_fetch_byte_case): Declare even if RE_NO_INTERNAL_PROTOTYPES
+       is defined, since we now use prototypes always.
+
+       * regex.h (_RE_ARGS): Remove.  No longer needed, since we assume
+       C89 or better.  All uses removed.
+
 2005-08-19  Paul Eggert  <eggert@cs.ucla.edu>
 
        * regex_internal.c (re_acquire_state, re_acquire_state_context)
index 43a111e..aa4f08d 100644 (file)
@@ -237,10 +237,8 @@ const size_t __re_error_msgid_idx[] attribute_hidden =
    are set in BUFP on entry.  */
 
 const char *
-re_compile_pattern (pattern, length, bufp)
-    const char *pattern;
-    size_t length;
-    struct re_pattern_buffer *bufp;
+re_compile_pattern (const char *pattern, size_t length,
+                   struct re_pattern_buffer *bufp)
 {
   reg_errcode_t ret;
 
@@ -278,8 +276,7 @@ reg_syntax_t re_syntax_options;
    defined in regex.h.  We return the old syntax.  */
 
 reg_syntax_t
-re_set_syntax (syntax)
-    reg_syntax_t syntax;
+re_set_syntax (reg_syntax_t syntax)
 {
   reg_syntax_t ret = re_syntax_options;
 
@@ -291,8 +288,7 @@ weak_alias (__re_set_syntax, re_set_syntax)
 #endif
 
 int
-re_compile_fastmap (bufp)
-    struct re_pattern_buffer *bufp;
+re_compile_fastmap (struct re_pattern_buffer *bufp)
 {
   re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
   char *fastmap = bufp->fastmap;
@@ -325,10 +321,8 @@ re_set_fastmap (char *fastmap, int icase, int ch)
    Compile fastmap for the initial_state INIT_STATE.  */
 
 static void
-re_compile_fastmap_iter (bufp, init_state, fastmap)
-     regex_t *bufp;
-     const re_dfastate_t *init_state;
-     char *fastmap;
+re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
+                        char *fastmap)
 {
   re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
   int node_cnt;
@@ -470,10 +464,7 @@ re_compile_fastmap_iter (bufp, init_state, fastmap)
    the return codes and their meanings.)  */
 
 int
-regcomp (preg, pattern, cflags)
-    regex_t *__restrict preg;
-    const char *__restrict pattern;
-    int cflags;
+regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags)
 {
   reg_errcode_t ret;
   reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
@@ -532,11 +523,7 @@ weak_alias (__regcomp, regcomp)
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-regerror (errcode, preg, errbuf, errbuf_size)
-    int errcode;
-    const regex_t *preg;
-    char *errbuf;
-    size_t errbuf_size;
+regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
 {
   const char *msg;
   size_t msg_size;
@@ -644,8 +631,7 @@ free_dfa_content (re_dfa_t *dfa)
 /* Free dynamically allocated space used by PREG.  */
 
 void
-regfree (preg)
-    regex_t *preg;
+regfree (regex_t *preg)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   if (BE (dfa != NULL, 1))
@@ -737,11 +723,8 @@ libc_freeres_fn (free_mem)
    SYNTAX indicate regular expression's syntax.  */
 
 static reg_errcode_t
-re_compile_internal (preg, pattern, length, syntax)
-     regex_t *preg;
-     const char * pattern;
-     int length;
-     reg_syntax_t syntax;
+re_compile_internal (regex_t *preg, const char * pattern, int length,
+                    reg_syntax_t syntax)
 {
   reg_errcode_t err = REG_NOERROR;
   re_dfa_t *dfa;
@@ -838,9 +821,7 @@ re_compile_internal (preg, pattern, length, syntax)
    as the initial length of some arrays.  */
 
 static reg_errcode_t
-init_dfa (dfa, pat_len)
-     re_dfa_t *dfa;
-     int pat_len;
+init_dfa (re_dfa_t *dfa, int pat_len)
 {
   int table_size;
 #ifndef _LIBC
@@ -938,8 +919,7 @@ init_dfa (dfa, pat_len)
    character used by some operators like "\<", "\>", etc.  */
 
 static void
-init_word_char (dfa)
-     re_dfa_t *dfa;
+init_word_char (re_dfa_t *dfa)
 {
   int i, j, ch;
   dfa->word_ops_used = 1;
@@ -952,8 +932,7 @@ init_word_char (dfa)
 /* Free the work area which are only used while compiling.  */
 
 static void
-free_workarea_compile (preg)
-     regex_t *preg;
+free_workarea_compile (regex_t *preg)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   bin_tree_storage_t *storage, *next;
@@ -972,8 +951,7 @@ free_workarea_compile (preg)
 /* Create initial states for all contexts.  */
 
 static reg_errcode_t
-create_initial_state (dfa)
-     re_dfa_t *dfa;
+create_initial_state (re_dfa_t *dfa)
 {
   int first, i;
   reg_errcode_t err;
@@ -1055,8 +1033,7 @@ create_initial_state (dfa)
    DFA nodes where needed.  */
 
 static void
-optimize_utf8 (dfa)
-     re_dfa_t *dfa;
+optimize_utf8 (re_dfa_t *dfa)
 {
   int node, i, mb_chars = 0, has_period = 0;
 
@@ -1123,8 +1100,7 @@ optimize_utf8 (dfa)
    "eclosure", and "inveclosure".  */
 
 static reg_errcode_t
-analyze (preg)
-     regex_t *preg;
+analyze (regex_t *preg)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   reg_errcode_t ret;
@@ -1187,10 +1163,8 @@ analyze (preg)
    implement parse tree visits.  Instead, we use parent pointers and
    some hairy code in these two functions.  */
 static reg_errcode_t
-postorder (root, fn, extra)
-     bin_tree_t *root;
-     reg_errcode_t (fn (void *, bin_tree_t *));
-     void *extra;
+postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
+          void *extra)
 {
   bin_tree_t *node, *prev;
 
@@ -1221,10 +1195,8 @@ postorder (root, fn, extra)
 }
 
 static reg_errcode_t
-preorder (root, fn, extra)
-     bin_tree_t *root;
-     reg_errcode_t (fn (void *, bin_tree_t *));
-     void *extra;
+preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
+         void *extra)
 {
   bin_tree_t *node;
 
@@ -1256,9 +1228,7 @@ preorder (root, fn, extra)
    re_search_internal to map the inner one's opr.idx to this one's.  Adjust
    backreferences as well.  Requires a preorder visit.  */
 static reg_errcode_t
-optimize_subexps (extra, node)
-     void *extra;
-     bin_tree_t *node;
+optimize_subexps (void *extra, bin_tree_t *node)
 {
   re_dfa_t *dfa = (re_dfa_t *) extra;
 
@@ -1289,9 +1259,7 @@ optimize_subexps (extra, node)
 /* Lowering pass: Turn each SUBEXP node into the appropriate concatenation
    of OP_OPEN_SUBEXP, the body of the SUBEXP (if any) and OP_CLOSE_SUBEXP.  */
 static reg_errcode_t
-lower_subexps (extra, node)
-     void *extra;
-     bin_tree_t *node;
+lower_subexps (void *extra, bin_tree_t *node)
 {
   regex_t *preg = (regex_t *) extra;
   reg_errcode_t err = REG_NOERROR;
@@ -1313,10 +1281,7 @@ lower_subexps (extra, node)
 }
 
 static bin_tree_t *
-lower_subexp (err, preg, node)
-     reg_errcode_t *err;
-     regex_t *preg;
-     bin_tree_t *node;
+lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   bin_tree_t *body = node->left;
@@ -1352,9 +1317,7 @@ lower_subexp (err, preg, node)
 /* Pass 1 in building the NFA: compute FIRST and create unlinked automaton
    nodes.  Requires a postorder visit.  */
 static reg_errcode_t
-calc_first (extra, node)
-     void *extra;
-     bin_tree_t *node;
+calc_first (void *extra, bin_tree_t *node)
 {
   re_dfa_t *dfa = (re_dfa_t *) extra;
   if (node->token.type == CONCAT)
@@ -1374,9 +1337,7 @@ calc_first (extra, node)
 
 /* Pass 2: compute NEXT on the tree.  Preorder visit.  */
 static reg_errcode_t
-calc_next (extra, node)
-     void *extra;
-     bin_tree_t *node;
+calc_next (void *extra, bin_tree_t *node)
 {
   switch (node->token.type)
     {
@@ -1399,9 +1360,7 @@ calc_next (extra, node)
 
 /* Pass 3: link all DFA nodes to their NEXT node (any order will do).  */
 static reg_errcode_t
-link_nfa_nodes (extra, node)
-     void *extra;
-     bin_tree_t *node;
+link_nfa_nodes (void *extra, bin_tree_t *node)
 {
   re_dfa_t *dfa = (re_dfa_t *) extra;
   int idx = node->node_idx;
@@ -1461,11 +1420,8 @@ link_nfa_nodes (extra, node)
    to their own constraint.  */
 
 static reg_errcode_t
-duplicate_node_closure (dfa, top_org_node, top_clone_node, root_node,
-                       init_constraint)
-     re_dfa_t *dfa;
-     int top_org_node, top_clone_node, root_node;
-     unsigned int init_constraint;
+duplicate_node_closure (re_dfa_t *dfa, int top_org_node, int top_clone_node,
+                       int root_node, unsigned int init_constraint)
 {
   int org_node, clone_node, ret;
   unsigned int constraint = init_constraint;
@@ -1575,10 +1531,7 @@ duplicate_node_closure (dfa, top_org_node, top_clone_node, root_node,
    satisfies the constraint CONSTRAINT.  */
 
 static int
-search_duplicated_node (dfa, org_node, constraint)
-     re_dfa_t *dfa;
-     int org_node;
-     unsigned int constraint;
+search_duplicated_node (re_dfa_t *dfa, int org_node, unsigned int constraint)
 {
   int idx;
   for (idx = dfa->nodes_len - 1; dfa->nodes[idx].duplicated && idx > 0; --idx)
@@ -1595,10 +1548,7 @@ search_duplicated_node (dfa, org_node, constraint)
    available.  */
 
 static int
-duplicate_node (dfa, org_idx, constraint)
-     re_dfa_t *dfa;
-     int org_idx;
-     unsigned int constraint;
+duplicate_node (re_dfa_t *dfa, int org_idx, unsigned int constraint)
 {
   int dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]);
   if (BE (dup_idx != -1, 1))
@@ -1615,8 +1565,7 @@ duplicate_node (dfa, org_idx, constraint)
 }
 
 static reg_errcode_t
-calc_inveclosure (dfa)
-     re_dfa_t *dfa;
+calc_inveclosure (re_dfa_t *dfa)
 {
   int src, idx, ret;
   for (idx = 0; idx < dfa->nodes_len; ++idx)
@@ -1639,8 +1588,7 @@ calc_inveclosure (dfa)
 /* Calculate "eclosure" for all the node in DFA.  */
 
 static reg_errcode_t
-calc_eclosure (dfa)
-     re_dfa_t *dfa;
+calc_eclosure (re_dfa_t *dfa)
 {
   int node_idx, incomplete;
 #ifdef DEBUG
@@ -1684,10 +1632,7 @@ calc_eclosure (dfa)
 /* Calculate epsilon closure of NODE.  */
 
 static reg_errcode_t
-calc_eclosure_iter (new_set, dfa, node, root)
-     re_node_set *new_set;
-     re_dfa_t *dfa;
-     int node, root;
+calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
 {
   reg_errcode_t err;
   unsigned int constraint;
@@ -1767,10 +1712,7 @@ calc_eclosure_iter (new_set, dfa, node, root)
    We must not use this function inside bracket expressions.  */
 
 static void
-fetch_token (result, input, syntax)
-     re_token_t *result;
-     re_string_t *input;
-     reg_syntax_t syntax;
+fetch_token (re_token_t *result, re_string_t *input, reg_syntax_t syntax)
 {
   re_string_skip_bytes (input, peek_token (result, input, syntax));
 }
@@ -1779,10 +1721,7 @@ fetch_token (result, input, syntax)
    We must not use this function inside bracket expressions.  */
 
 static int
-peek_token (token, input, syntax)
-     re_token_t *token;
-     re_string_t *input;
-     reg_syntax_t syntax;
+peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
 {
   unsigned char c;
 
@@ -2020,10 +1959,7 @@ peek_token (token, input, syntax)
    We must not use this function out of bracket expressions.  */
 
 static int
-peek_token_bracket (token, input, syntax)
-     re_token_t *token;
-     re_string_t *input;
-     reg_syntax_t syntax;
+peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
 {
   unsigned char c;
   if (re_string_eoi (input))
@@ -2119,11 +2055,8 @@ peek_token_bracket (token, input, syntax)
    EOR means end of regular expression.  */
 
 static bin_tree_t *
-parse (regexp, preg, syntax, err)
-     re_string_t *regexp;
-     regex_t *preg;
-     reg_syntax_t syntax;
-     reg_errcode_t *err;
+parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
+       reg_errcode_t *err)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   bin_tree_t *tree, *eor, *root;
@@ -2156,13 +2089,8 @@ parse (regexp, preg, syntax, err)
    ALT means alternative, which represents the operator `|'.  */
 
 static bin_tree_t *
-parse_reg_exp (regexp, preg, token, syntax, nest, err)
-     re_string_t *regexp;
-     regex_t *preg;
-     re_token_t *token;
-     reg_syntax_t syntax;
-     int nest;
-     reg_errcode_t *err;
+parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
+              reg_syntax_t syntax, int nest, reg_errcode_t *err)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   bin_tree_t *tree, *branch = NULL;
@@ -2202,13 +2130,8 @@ parse_reg_exp (regexp, preg, token, syntax, nest, err)
    CAT means concatenation.  */
 
 static bin_tree_t *
-parse_branch (regexp, preg, token, syntax, nest, err)
-     re_string_t *regexp;
-     regex_t *preg;
-     re_token_t *token;
-     reg_syntax_t syntax;
-     int nest;
-     reg_errcode_t *err;
+parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
+             reg_syntax_t syntax, int nest, reg_errcode_t *err)
 {
   bin_tree_t *tree, *exp;
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
@@ -2247,13 +2170,8 @@ parse_branch (regexp, preg, token, syntax, nest, err)
 */
 
 static bin_tree_t *
-parse_expression (regexp, preg, token, syntax, nest, err)
-     re_string_t *regexp;
-     regex_t *preg;
-     re_token_t *token;
-     reg_syntax_t syntax;
-     int nest;
-     reg_errcode_t *err;
+parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
+                 reg_syntax_t syntax, int nest, reg_errcode_t *err)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   bin_tree_t *tree;
@@ -2468,13 +2386,8 @@ parse_expression (regexp, preg, token, syntax, nest, err)
 */
 
 static bin_tree_t *
-parse_sub_exp (regexp, preg, token, syntax, nest, err)
-     re_string_t *regexp;
-     regex_t *preg;
-     re_token_t *token;
-     reg_syntax_t syntax;
-     int nest;
-     reg_errcode_t *err;
+parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
+              reg_syntax_t syntax, int nest, reg_errcode_t *err)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   bin_tree_t *tree;
@@ -2509,13 +2422,8 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
 /* This function parse repetition operators like "*", "+", "{1,3}" etc.  */
 
 static bin_tree_t *
-parse_dup_op (elem, regexp, dfa, token, syntax, err)
-     bin_tree_t *elem;
-     re_string_t *regexp;
-     re_dfa_t *dfa;
-     re_token_t *token;
-     reg_syntax_t syntax;
-     reg_errcode_t *err;
+parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
+             re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err)
 {
   bin_tree_t *tree = NULL, *old_tree = NULL;
   int i, start, end, start_idx = re_string_cur_idx (regexp);
@@ -2654,15 +2562,11 @@ parse_dup_op (elem, regexp, dfa, token, syntax, err)
      update it.  */
 
 static reg_errcode_t
+build_range_exp (re_bitset_ptr_t sbcset,
 # ifdef RE_ENABLE_I18N
-build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem)
-     re_charset_t *mbcset;
-     int *range_alloc;
-# else /* not RE_ENABLE_I18N */
-build_range_exp (sbcset, start_elem, end_elem)
-# endif /* not RE_ENABLE_I18N */
-     re_bitset_ptr_t sbcset;
-     bracket_elem_t *start_elem, *end_elem;
+                re_charset_t *mbcset, int *range_alloc,
+# endif
+                bracket_elem_t *start_elem, bracket_elem_t *end_elem)
 {
   unsigned int start_ch, end_ch;
   /* Equivalence Classes and Character Classes can't be a range start/end.  */
@@ -2775,15 +2679,11 @@ build_range_exp (sbcset, start_elem, end_elem)
    pointer argument since we may update it.  */
 
 static reg_errcode_t
+build_collating_symbol (re_bitset_ptr_t sbcset,
 # ifdef RE_ENABLE_I18N
-build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name)
-     re_charset_t *mbcset;
-     int *coll_sym_alloc;
-# else /* not RE_ENABLE_I18N */
-build_collating_symbol (sbcset, name)
-# endif /* not RE_ENABLE_I18N */
-     re_bitset_ptr_t sbcset;
-     const unsigned char *name;
+                       re_charset_t *mbcset, int *coll_sym_alloc,
+# endif
+                       const unsigned char *name)
 {
   size_t name_len = strlen ((const char *) name);
   if (BE (name_len != 1, 0))
@@ -2800,12 +2700,8 @@ build_collating_symbol (sbcset, name)
    "[[.a-a.]]" etc.  */
 
 static bin_tree_t *
-parse_bracket_exp (regexp, dfa, token, syntax, err)
-     re_string_t *regexp;
-     re_dfa_t *dfa;
-     re_token_t *token;
-     reg_syntax_t syntax;
-     reg_errcode_t *err;
+parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
+                  reg_syntax_t syntax, reg_errcode_t *err)
 {
 #ifdef _LIBC
   const unsigned char *collseqmb;
@@ -3356,15 +3252,9 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
 /* Parse an element in the bracket expression.  */
 
 static reg_errcode_t
-parse_bracket_element (elem, regexp, token, token_len, dfa, syntax,
-                      accept_hyphen)
-     bracket_elem_t *elem;
-     re_string_t *regexp;
-     re_token_t *token;
-     int token_len;
-     re_dfa_t *dfa;
-     reg_syntax_t syntax;
-     int accept_hyphen;
+parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
+                      re_token_t *token, int token_len, re_dfa_t *dfa,
+                      reg_syntax_t syntax, int accept_hyphen)
 {
 #ifdef RE_ENABLE_I18N
   int cur_char_size;
@@ -3402,10 +3292,8 @@ parse_bracket_element (elem, regexp, token, token_len, dfa, syntax,
    [=<equivalent_class>=].  */
 
 static reg_errcode_t
-parse_bracket_symbol (elem, regexp, token)
-     bracket_elem_t *elem;
-     re_string_t *regexp;
-     re_token_t *token;
+parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
+                     re_token_t *token)
 {
   unsigned char ch, delim = token->opr.c;
   int i = 0;
@@ -3451,15 +3339,11 @@ parse_bracket_symbol (elem, regexp, token)
      is a pointer argument sinse we may update it.  */
 
 static reg_errcode_t
+build_equiv_class (re_bitset_ptr_t sbcset,
 #ifdef RE_ENABLE_I18N
-build_equiv_class (sbcset, mbcset, equiv_class_alloc, name)
-     re_charset_t *mbcset;
-     int *equiv_class_alloc;
-#else /* not RE_ENABLE_I18N */
-build_equiv_class (sbcset, name)
-#endif /* not RE_ENABLE_I18N */
-     re_bitset_ptr_t sbcset;
-     const unsigned char *name;
+                  re_charset_t *mbcset, int *equiv_class_alloc,
+#endif
+                  const unsigned char *name)
 {
 #if defined _LIBC
   uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
@@ -3546,17 +3430,11 @@ build_equiv_class (sbcset, name)
      is a pointer argument sinse we may update it.  */
 
 static reg_errcode_t
+build_charclass (unsigned RE_TRANSLATE_TYPE trans, re_bitset_ptr_t sbcset,
 #ifdef RE_ENABLE_I18N
-build_charclass (trans, sbcset, mbcset, char_class_alloc, class_name, syntax)
-     re_charset_t *mbcset;
-     int *char_class_alloc;
-#else /* not RE_ENABLE_I18N */
-build_charclass (trans, sbcset, class_name, syntax)
-#endif /* not RE_ENABLE_I18N */
-     unsigned RE_TRANSLATE_TYPE trans;
-     re_bitset_ptr_t sbcset;
-     const unsigned char *class_name;
-     reg_syntax_t syntax;
+                re_charset_t *mbcset, int *char_class_alloc,
+#endif
+                const unsigned char *class_name, reg_syntax_t syntax)
 {
   int i;
   const char *name = (const char *) class_name;
@@ -3626,13 +3504,10 @@ build_charclass (trans, sbcset, class_name, syntax)
 }
 
 static bin_tree_t *
-build_charclass_op (dfa, trans, class_name, extra, non_match, err)
-     re_dfa_t *dfa;
-     unsigned RE_TRANSLATE_TYPE trans;
-     const unsigned char *class_name;
-     const unsigned char *extra;
-     int non_match;
-     reg_errcode_t *err;
+build_charclass_op (re_dfa_t *dfa, unsigned RE_TRANSLATE_TYPE trans,
+                   const unsigned char *class_name,
+                   const unsigned char *extra,
+                   int non_match, reg_errcode_t *err)
 {
   re_bitset_ptr_t sbcset;
 #ifdef RE_ENABLE_I18N
@@ -3746,10 +3621,7 @@ build_charclass_op (dfa, trans, class_name, extra, non_match, err)
    Return -2, If an error is occured.  */
 
 static int
-fetch_number (input, token, syntax)
-     re_string_t *input;
-     re_token_t *token;
-     reg_syntax_t syntax;
+fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
 {
   int num = -1;
   unsigned char c;
@@ -3789,11 +3661,8 @@ free_charset (re_charset_t *cset)
 /* Create a tree node.  */
 
 static bin_tree_t *
-create_tree (dfa, left, right, type)
-     re_dfa_t *dfa;
-     bin_tree_t *left;
-     bin_tree_t *right;
-     re_token_type_t type;
+create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
+            re_token_type_t type)
 {
   re_token_t t;
   t.type = type;
@@ -3801,11 +3670,8 @@ create_tree (dfa, left, right, type)
 }
 
 static bin_tree_t *
-create_token_tree (dfa, left, right, token)
-     re_dfa_t *dfa;
-     bin_tree_t *left;
-     bin_tree_t *right;
-     const re_token_t *token;
+create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
+                  const re_token_t *token)
 {
   bin_tree_t *tree;
   if (BE (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE, 0))
@@ -3841,9 +3707,7 @@ create_token_tree (dfa, left, right, token)
    To be called from preorder or postorder.  */
 
 static reg_errcode_t
-mark_opt_subexp (extra, node)
-     void *extra;
-     bin_tree_t *node;
+mark_opt_subexp (void *extra, bin_tree_t *node)
 {
   int idx = (int) (long) extra;
   if (node->token.type == SUBEXP && node->token.opr.idx == idx)
@@ -3883,9 +3747,7 @@ free_tree (void *extra, bin_tree_t *node)
    it's easier to duplicate.  */
 
 static bin_tree_t *
-duplicate_tree (root, dfa)
-     const bin_tree_t *root;
-     re_dfa_t *dfa;
+duplicate_tree (const bin_tree_t *root, re_dfa_t *dfa)
 {
   const bin_tree_t *node;
   bin_tree_t *dup_root;
index bdce605..425f60e 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for data structures and routines for the regular
    expression library.
-   Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003
+   Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -451,38 +451,21 @@ typedef struct
 \f
 /* Declarations for routines.  */
 
-/* To avoid duplicating every routine declaration -- once with a
-   prototype (if we are ANSI), and once without (if we aren't) -- we
-   use the following macro to declare argument types.  This
-   unfortunately clutters up the declarations a bit, but I think it's
-   worth it.  */
-
-#if __STDC__
-
-# define _RE_ARGS(args) args
-
-#else /* not __STDC__ */
-
-# define _RE_ARGS(args) ()
-
-#endif /* not __STDC__ */
-
 /* Sets the current default syntax to SYNTAX, and return the old syntax.
    You can also simply assign to the `re_syntax_options' variable.  */
-extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
+extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
 
 /* Compile the regular expression PATTERN, with length LENGTH
    and syntax given by the global `re_syntax_options', into the buffer
    BUFFER.  Return NULL if successful, and an error string if not.  */
-extern const char *re_compile_pattern
-  _RE_ARGS ((const char *pattern, size_t length,
-             struct re_pattern_buffer *buffer));
+extern const char *re_compile_pattern (const char *pattern, size_t length,
+                                      struct re_pattern_buffer *buffer);
 
 
 /* Compile a fastmap for the compiled pattern in BUFFER; used to
    accelerate searches.  Return 0 if successful and -2 if was an
    internal error.  */
-extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
+extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
 
 
 /* Search in the string STRING (with length LENGTH) for the pattern
@@ -490,31 +473,29 @@ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
    characters.  Return the starting position of the match, -1 for no
    match, or -2 for an internal error.  Also return register
    information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
-extern int re_search
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
-            int length, int start, int range, struct re_registers *regs));
+extern int re_search (struct re_pattern_buffer *buffer, const char *string,
+                     int length, int start, int range,
+                     struct re_registers *regs);
 
 
 /* Like `re_search', but search in the concatenation of STRING1 and
    STRING2.  Also, stop searching at index START + STOP.  */
-extern int re_search_2
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
-             int length1, const char *string2, int length2,
-             int start, int range, struct re_registers *regs, int stop));
+extern int re_search_2 (struct re_pattern_buffer *buffer, const char *string1,
+                       int length1, const char *string2, int length2,
+                       int start, int range, struct re_registers *regs,
+                       int stop);
 
 
 /* Like `re_search', but return how many characters in STRING the regexp
    in BUFFER matched, starting at position START.  */
-extern int re_match
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
-             int length, int start, struct re_registers *regs));
+extern int re_match (struct re_pattern_buffer *buffer, const char *string,
+                    int length, int start, struct re_registers *regs);
 
 
 /* Relates to `re_match' as `re_search_2' relates to `re_search'.  */
-extern int re_match_2
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
-             int length1, const char *string2, int length2,
-             int start, struct re_registers *regs, int stop));
+extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1,
+                      int length1, const char *string2, int length2,
+                      int start, struct re_registers *regs, int stop);
 
 
 /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
@@ -529,15 +510,15 @@ extern int re_match_2
    Unless this function is called, the first search or match using
    PATTERN_BUFFER will allocate its own register data, without
    freeing the old data.  */
-extern void re_set_registers
-  _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
-             unsigned num_regs, regoff_t *starts, regoff_t *ends));
+extern void re_set_registers (struct re_pattern_buffer *buffer,
+                             struct re_registers *regs, unsigned num_regs,
+                             regoff_t *starts, regoff_t *ends);
 
 #if defined _REGEX_RE_COMP || defined _LIBC
 # ifndef _CRAY
 /* 4.2 bsd compatibility.  */
-extern char *re_comp _RE_ARGS ((const char *));
-extern int re_exec _RE_ARGS ((const char *));
+extern char *re_comp (const char *);
+extern int re_exec (const char *);
 # endif
 #endif
 
@@ -562,19 +543,19 @@ extern int re_exec _RE_ARGS ((const char *));
 #endif
 
 /* POSIX compatibility.  */
-extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
-                             const char *__restrict __pattern,
-                             int __cflags));
+extern int regcomp (regex_t *__restrict __preg,
+                   const char *__restrict __pattern,
+                   int __cflags);
 
-extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
-                             const char *__restrict __string, size_t __nmatch,
-                             regmatch_t __pmatch[__restrict_arr],
-                             int __eflags));
+extern int regexec (const regex_t *__restrict __preg,
+                   const char *__restrict __string, size_t __nmatch,
+                   regmatch_t __pmatch[__restrict_arr],
+                   int __eflags);
 
-extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
-                                 char *__errbuf, size_t __errbuf_size));
+extern size_t regerror (int __errcode, const regex_t *__preg,
+                       char *__errbuf, size_t __errbuf_size);
 
-extern void regfree _RE_ARGS ((regex_t *__preg));
+extern void regfree (regex_t *__preg);
 
 
 #ifdef __cplusplus
index 6e46199..80e8406 100644 (file)
@@ -43,12 +43,9 @@ static unsigned int inline 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;
+internal_function
+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;
@@ -74,12 +71,9 @@ 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;
+internal_function
+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));
@@ -140,9 +134,8 @@ 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;
+internal_function
+re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
 {
 #ifdef RE_ENABLE_I18N
   if (pstr->mb_cur_max > 1)
@@ -174,13 +167,10 @@ 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;
+internal_function
+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;
@@ -209,8 +199,8 @@ 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;
+internal_function
+build_wcs_buffer (re_string_t *pstr)
 {
 #ifdef _LIBC
   unsigned char buf[MB_LEN_MAX];
@@ -277,8 +267,8 @@ build_wcs_buffer (pstr)
    but for REG_ICASE.  */
 
 static int
-build_wcs_upper_buffer (pstr)
-     re_string_t *pstr;
+internal_function
+build_wcs_upper_buffer (re_string_t *pstr)
 {
   mbstate_t prev_st;
   int src_idx, byte_idx, end_idx, remain_len;
@@ -493,10 +483,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;
@@ -530,8 +518,8 @@ 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;
+internal_function
+build_upper_buffer (re_string_t *pstr)
 {
   int char_idx, end_idx;
   end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
@@ -553,8 +541,8 @@ build_upper_buffer (pstr)
 /* Apply TRANS to the buffer in PSTR.  */
 
 static void
-re_string_translate_buffer (pstr)
-     re_string_t *pstr;
+internal_function
+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;
@@ -574,9 +562,8 @@ 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;
+internal_function
+re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
 {
   int offset = idx - pstr->raw_mbs_idx;
   if (BE (offset < 0, 0))
@@ -752,9 +739,8 @@ re_string_reconstruct (pstr, idx, eflags)
 }
 
 static unsigned char
-re_string_peek_byte_case (pstr, idx)
-     const re_string_t *pstr;
-     int idx;
+internal_function
+re_string_peek_byte_case (const re_string_t *pstr, int idx)
 {
   int ch, off;
 
@@ -789,8 +775,8 @@ re_string_peek_byte_case (pstr, idx)
 }
 
 static unsigned char
-re_string_fetch_byte_case (pstr)
-     re_string_t *pstr;
+internal_function
+re_string_fetch_byte_case (re_string_t *pstr)
 {
   if (BE (!pstr->mbs_allocated, 1))
     return re_string_fetch_byte (pstr);
@@ -826,8 +812,8 @@ re_string_fetch_byte_case (pstr)
 }
 
 static void
-re_string_destruct (pstr)
-     re_string_t *pstr;
+internal_function
+re_string_destruct (re_string_t *pstr)
 {
 #ifdef RE_ENABLE_I18N
   re_free (pstr->wcs);
@@ -840,9 +826,8 @@ 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;
+internal_function
+re_string_context_at (const re_string_t *input, int idx, int eflags)
 {
   int c;
   if (BE (idx < 0, 0))
@@ -886,9 +871,8 @@ 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;
+internal_function
+re_node_set_alloc (re_node_set *set, int size)
 {
   set->alloc = size;
   set->nelem = 0;
@@ -899,9 +883,8 @@ re_node_set_alloc (set, size)
 }
 
 static reg_errcode_t
-re_node_set_init_1 (set, elem)
-     re_node_set *set;
-     int elem;
+internal_function
+re_node_set_init_1 (re_node_set *set, int elem)
 {
   set->alloc = 1;
   set->nelem = 1;
@@ -916,9 +899,8 @@ 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;
+internal_function
+re_node_set_init_2 (re_node_set *set, int elem1, int elem2)
 {
   set->alloc = 2;
   set->elems = re_malloc (int, 2);
@@ -947,9 +929,8 @@ 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;
+internal_function
+re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
 {
   dest->nelem = src->nelem;
   if (src->nelem > 0)
@@ -973,9 +954,9 @@ 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;
+internal_function
+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)
@@ -1064,9 +1045,9 @@ 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;
+internal_function
+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)
@@ -1117,9 +1098,8 @@ 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;
+internal_function
+re_node_set_merge (re_node_set *dest, const re_node_set *src)
 {
   int is, id, sbase, delta;
   if (src == NULL || src->nelem == 0)
@@ -1201,9 +1181,8 @@ 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;
+internal_function
+re_node_set_insert (re_node_set *set, int elem)
 {
   int idx;
   /* In case the set is empty.  */
@@ -1259,9 +1238,8 @@ 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;
+internal_function
+re_node_set_insert_last (re_node_set *set, int elem)
 {
   /* Realloc if we need.  */
   if (set->alloc == set->nelem)
@@ -1283,8 +1261,8 @@ 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;
+internal_function
+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)
@@ -1298,9 +1276,8 @@ 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;
+internal_function
+re_node_set_contains (const re_node_set *set, int elem)
 {
   unsigned int idx, right, mid;
   if (set->nelem <= 0)
@@ -1321,9 +1298,8 @@ re_node_set_contains (set, elem)
 }
 
 static void
-re_node_set_remove_at (set, idx)
-     re_node_set *set;
-     int idx;
+internal_function
+re_node_set_remove_at (re_node_set *set, int idx)
 {
   if (idx < 0 || idx >= set->nelem)
     return;
@@ -1337,9 +1313,8 @@ 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;
+internal_function
+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))
@@ -1379,9 +1354,8 @@ re_dfa_add_node (dfa, token)
 }
 
 static unsigned int inline
-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;
@@ -1400,10 +1374,8 @@ calc_state_hash (nodes, context)
           optimization.  */
 
 static re_dfastate_t*
-re_acquire_state (err, dfa, nodes)
-     reg_errcode_t *err;
-     re_dfa_t *dfa;
-     const re_node_set *nodes;
+internal_function
+re_acquire_state (reg_errcode_t *err, re_dfa_t *dfa, const re_node_set *nodes)
 {
   unsigned int hash;
   re_dfastate_t *new_state;
@@ -1452,11 +1424,9 @@ re_acquire_state (err, dfa, nodes)
           optimization.  */
 
 static re_dfastate_t*
-re_acquire_state_context (err, dfa, nodes, context)
-     reg_errcode_t *err;
-     re_dfa_t *dfa;
-     const re_node_set *nodes;
-     unsigned int context;
+internal_function
+re_acquire_state_context (reg_errcode_t *err, re_dfa_t *dfa,
+                         const re_node_set *nodes, unsigned int context)
 {
   unsigned int hash;
   re_dfastate_t *new_state;
@@ -1498,10 +1468,8 @@ re_acquire_state_context (err, dfa, nodes, context)
    indicates the error code if failed.  */
 
 static reg_errcode_t
-register_state (dfa, newstate, hash)
-     re_dfa_t *dfa;
-     re_dfastate_t *newstate;
-     unsigned int hash;
+internal_function
+register_state (re_dfa_t *dfa, re_dfastate_t *newstate, unsigned int hash)
 {
   struct re_state_table_entry *spot;
   reg_errcode_t err;
@@ -1537,10 +1505,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)
-     re_dfa_t *dfa;
-     const re_node_set *nodes;
-     unsigned int hash;
+internal_function
+create_ci_newstate (re_dfa_t *dfa, const re_node_set *nodes, unsigned int hash)
 {
   int i;
   reg_errcode_t err;
@@ -1588,10 +1554,9 @@ 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)
-     re_dfa_t *dfa;
-     const re_node_set *nodes;
-     unsigned int context, hash;
+internal_function
+create_cd_newstate (re_dfa_t *dfa, const re_node_set *nodes,
+                   unsigned int context, unsigned int hash)
 {
   int i, nctx_nodes = 0;
   reg_errcode_t err;
@@ -1664,8 +1629,8 @@ create_cd_newstate (dfa, nodes, context, hash)
 }
 
 static void
-free_state (state)
-     re_dfastate_t *state;
+internal_function
+free_state (re_dfastate_t *state)
 {
   re_node_set_free (&state->non_eps_nodes);
   re_node_set_free (&state->inveclosure);
index 74a52ec..31e21af 100644 (file)
@@ -375,7 +375,6 @@ typedef struct re_dfa_t re_dfa_t;
 # 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,
@@ -390,21 +389,21 @@ static reg_errcode_t re_string_reconstruct (re_string_t *pstr, int idx,
 static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
                                                int new_buf_len)
      internal_function;
-# ifdef RE_ENABLE_I18N
+#ifdef RE_ENABLE_I18N
 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 */
+#endif /* RE_ENABLE_I18N */
 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
+#ifdef RE_ENABLE_I18N
 static int re_string_elem_size_at (const re_string_t *pstr, int idx)
      internal_function __attribute ((pure));
 static inline int re_string_char_size_at (const re_string_t *pstr, int idx)
      internal_function __attribute ((pure));
 static inline wint_t re_string_wchar_at (const re_string_t *pstr, int idx)
      internal_function __attribute ((pure));
-# endif /* RE_ENABLE_I18N */
+#endif /* RE_ENABLE_I18N */
 static unsigned int re_string_context_at (const re_string_t *input, int idx,
                                          int eflags)
      internal_function __attribute ((pure));
@@ -413,7 +412,7 @@ static unsigned char re_string_peek_byte_case (const re_string_t *pstr,
      internal_function __attribute ((pure));
 static unsigned char re_string_fetch_byte_case (re_string_t *pstr)
      internal_function __attribute ((pure));
-#endif
+
 #define re_string_peek_byte(pstr, offset) \
   ((pstr)->mbs[(pstr)->cur_idx + offset])
 #define re_string_fetch_byte(pstr) \
index 96e0aa4..00867aa 100644 (file)
@@ -209,12 +209,8 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx) internal_function
    We return 0 if we find a match and REG_NOMATCH if not.  */
 
 int
-regexec (preg, string, nmatch, pmatch, eflags)
-    const regex_t *__restrict preg;
-    const char *__restrict string;
-    size_t nmatch;
-    regmatch_t pmatch[];
-    int eflags;
+regexec (const regex_t *__restrict preg, const char *__restrict string,
+        size_t nmatch, regmatch_t pmatch[], int eflags)
 {
   reg_errcode_t err;
   int start, length;
@@ -295,11 +291,8 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
    match was found and -2 indicates an internal error.  */
 
 int
-re_match (bufp, string, length, start, regs)
-    struct re_pattern_buffer *bufp;
-    const char *string;
-    int length, start;
-    struct re_registers *regs;
+re_match (struct re_pattern_buffer *bufp, const char *string,
+         int length, int start, struct re_registers *regs)
 {
   return re_search_stub (bufp, string, length, start, 0, length, regs, 1);
 }
@@ -308,11 +301,8 @@ weak_alias (__re_match, re_match)
 #endif
 
 int
-re_search (bufp, string, length, start, range, regs)
-    struct re_pattern_buffer *bufp;
-    const char *string;
-    int length, start, range;
-    struct re_registers *regs;
+re_search (struct re_pattern_buffer *bufp, const char *string,
+          int length, int start, int range, struct re_registers *regs)
 {
   return re_search_stub (bufp, string, length, start, range, length, regs, 0);
 }
@@ -321,11 +311,10 @@ weak_alias (__re_search, re_search)
 #endif
 
 int
-re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop)
-    struct re_pattern_buffer *bufp;
-    const char *string1, *string2;
-    int length1, length2, start, stop;
-    struct re_registers *regs;
+re_match_2 (struct re_pattern_buffer *bufp,
+           const char *string1, int length1,
+           const char *string2, int length2,
+           int start, struct re_registers *regs, int stop)
 {
   return re_search_2_stub (bufp, string1, length1, string2, length2,
                           start, 0, regs, stop, 1);
@@ -335,11 +324,10 @@ weak_alias (__re_match_2, re_match_2)
 #endif
 
 int
-re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop)
-    struct re_pattern_buffer *bufp;
-    const char *string1, *string2;
-    int length1, length2, start, range, stop;
-    struct re_registers *regs;
+re_search_2 (struct re_pattern_buffer *bufp,
+            const char *string1, int length1,
+            const char *string2, int length2,
+            int start, int range, struct re_registers *regs, int stop)
 {
   return re_search_2_stub (bufp, string1, length1, string2, length2,
                           start, range, regs, stop, 0);
@@ -349,12 +337,12 @@ weak_alias (__re_search_2, re_search_2)
 #endif
 
 static int
-re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
-                 stop, ret_len)
-    struct re_pattern_buffer *bufp;
-    const char *string1, *string2;
-    int length1, length2, start, range, stop, ret_len;
-    struct re_registers *regs;
+internal_function
+re_search_2_stub (struct re_pattern_buffer *bufp,
+                 const char *string1, int length1,
+                 const char *string2, int length2,
+                 int start, int range, struct re_registers *regs, int stop,
+                 int ret_len)
 {
   const char *str;
   int rval;
@@ -395,11 +383,11 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
    otherwise the position of the match is returned.  */
 
 static int
-re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
-    struct re_pattern_buffer *bufp;
-    const char *string;
-    int length, start, range, stop, ret_len;
-    struct re_registers *regs;
+internal_function
+re_search_stub (struct re_pattern_buffer *bufp,
+               const char *string, int length,
+               int start, int range, int stop, struct re_registers *regs,
+               int ret_len)
 {
   reg_errcode_t result;
   regmatch_t *pmatch;
@@ -484,10 +472,9 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
 }
 
 static unsigned
-re_copy_regs (regs, pmatch, nregs, regs_allocated)
-    struct re_registers *regs;
-    regmatch_t *pmatch;
-    int nregs, regs_allocated;
+internal_function
+re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, int nregs,
+             int regs_allocated)
 {
   int rval = REGS_REALLOCATE;
   int i;
@@ -553,11 +540,8 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated)
    freeing the old data.  */
 
 void
-re_set_registers (bufp, regs, num_regs, starts, ends)
-    struct re_pattern_buffer *bufp;
-    struct re_registers *regs;
-    unsigned num_regs;
-    regoff_t *starts, *ends;
+re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs,
+                 unsigned int num_regs, regoff_t *starts, regoff_t *ends)
 {
   if (num_regs)
     {
@@ -604,13 +588,12 @@ re_exec (s)
    (START + RANGE >= 0 && START + RANGE <= LENGTH)  */
 
 static reg_errcode_t
-re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
-                   eflags)
-    const regex_t *preg;
-    const char *string;
-    int length, start, range, stop, eflags;
-    size_t nmatch;
-    regmatch_t pmatch[];
+internal_function
+re_search_internal (const regex_t *preg,
+                   const char *string, int length,
+                   int start, int range, int stop,
+                   size_t nmatch, regmatch_t pmatch[],
+                   int eflags)
 {
   reg_errcode_t err;
   re_dfa_t *dfa = (re_dfa_t *)preg->buffer;
@@ -923,8 +906,8 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
 }
 
 static reg_errcode_t
-prune_impossible_nodes (mctx)
-     re_match_context_t *mctx;
+internal_function
+prune_impossible_nodes (re_match_context_t *mctx)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int halt_node, match_last;
@@ -1009,10 +992,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;
+internal_function
+acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
+                           int idx)
 {
   re_dfa_t *const dfa = mctx->dfa;
   if (dfa->init_state->has_constraint)
@@ -1052,10 +1034,9 @@ 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;
+internal_function
+check_matching (re_match_context_t *mctx, int fl_longest_match,
+               int *p_match_first)
 {
   re_dfa_t *const dfa = mctx->dfa;
   reg_errcode_t err;
@@ -1184,10 +1165,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;
@@ -1205,10 +1185,9 @@ 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;
+internal_function
+check_halt_state_context (const re_match_context_t *mctx,
+                         const re_dfastate_t *state, int idx)
 {
   int i;
   unsigned int context;
@@ -1228,12 +1207,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)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int i, err;
@@ -1330,11 +1307,9 @@ 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;
+internal_function
+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++;
@@ -1359,11 +1334,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);
@@ -1381,12 +1354,9 @@ 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;
+internal_function
+set_regs (const regex_t *preg, const re_match_context_t *mctx,
+         size_t nmatch, regmatch_t *pmatch, int fl_backtrack)
 {
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   int idx, cur_node;
@@ -1469,8 +1439,8 @@ set_regs (preg, mctx, nmatch, pmatch, fl_backtrack)
 }
 
 static reg_errcode_t
-free_fail_stack_return (fs)
-     struct re_fail_stack_t *fs;
+internal_function
+free_fail_stack_return (struct re_fail_stack_t *fs)
 {
   if (fs)
     {
@@ -1486,10 +1456,9 @@ free_fail_stack_return (fs)
 }
 
 static void
-update_regs (dfa, pmatch, prev_idx_match, cur_node, cur_idx, nmatch)
-     re_dfa_t *dfa;
-     regmatch_t *pmatch, *prev_idx_match;
-     int cur_node, cur_idx, nmatch;
+internal_function
+update_regs (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)
@@ -1559,9 +1528,8 @@ 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)
-     re_match_context_t *mctx;
-     re_sift_context_t *sctx;
+internal_function
+sift_states_backward (re_match_context_t *mctx, re_sift_context_t *sctx)
 {
   reg_errcode_t err;
   int null_cnt = 0;
@@ -1618,11 +1586,9 @@ sift_states_backward (mctx, sctx)
 }
 
 static reg_errcode_t
-build_sifted_states (mctx, sctx, str_idx, cur_dest)
-     re_match_context_t *mctx;
-     re_sift_context_t *sctx;
-     int str_idx;
-     re_node_set *cur_dest;
+internal_function
+build_sifted_states (re_match_context_t *mctx, re_sift_context_t *sctx,
+                    int str_idx, re_node_set *cur_dest)
 {
   re_dfa_t *const dfa = mctx->dfa;
   re_node_set *cur_src = &mctx->state_log[str_idx]->non_eps_nodes;
@@ -1682,9 +1648,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;
 
@@ -1708,11 +1673,9 @@ clean_state_log_if_needed (mctx, next_state_log_idx)
 }
 
 static reg_errcode_t
-merge_state_array (dfa, dst, src, num)
-     re_dfa_t *dfa;
-     re_dfastate_t **dst;
-     re_dfastate_t **src;
-     int num;
+internal_function
+merge_state_array (re_dfa_t *dfa, re_dfastate_t **dst, re_dfastate_t **src,
+                  int num)
 {
   int st_idx;
   reg_errcode_t err;
@@ -1737,11 +1700,9 @@ merge_state_array (dfa, dst, src, num)
 }
 
 static reg_errcode_t
-update_cur_sifted_state (mctx, sctx, str_idx, dest_nodes)
-     re_match_context_t *mctx;
-     re_sift_context_t *sctx;
-     int str_idx;
-     re_node_set *dest_nodes;
+internal_function
+update_cur_sifted_state (re_match_context_t *mctx, re_sift_context_t *sctx,
+                        int str_idx, re_node_set *dest_nodes)
 {
   re_dfa_t *const dfa = mctx->dfa;
   reg_errcode_t err;
@@ -1786,10 +1747,9 @@ update_cur_sifted_state (mctx, sctx, str_idx, dest_nodes)
 }
 
 static reg_errcode_t
-add_epsilon_src_nodes (dfa, dest_nodes, candidates)
-     re_dfa_t *dfa;
-     re_node_set *dest_nodes;
-     const re_node_set *candidates;
+internal_function
+add_epsilon_src_nodes (re_dfa_t *dfa, re_node_set *dest_nodes,
+                      const re_node_set *candidates)
 {
   reg_errcode_t err = REG_NOERROR;
   int i;
@@ -1812,11 +1772,9 @@ add_epsilon_src_nodes (dfa, dest_nodes, candidates)
 }
 
 static reg_errcode_t
-sub_epsilon_src_nodes (dfa, node, dest_nodes, candidates)
-     re_dfa_t *dfa;
-     int node;
-     re_node_set *dest_nodes;
-     const re_node_set *candidates;
+internal_function
+sub_epsilon_src_nodes (re_dfa_t *dfa, int node, re_node_set *dest_nodes,
+                      const re_node_set *candidates)
 {
     int ecl_idx;
     reg_errcode_t err;
@@ -1863,10 +1821,9 @@ sub_epsilon_src_nodes (dfa, node, dest_nodes, candidates)
 }
 
 static int
-check_dst_limits (mctx, limits, dst_node, dst_idx, src_node, src_idx)
-     re_match_context_t *mctx;
-     re_node_set *limits;
-     int dst_node, dst_idx, src_node, src_idx;
+internal_function
+check_dst_limits (re_match_context_t *mctx, re_node_set *limits,
+                 int dst_node, int dst_idx, int src_node, int src_idx)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int lim_idx, src_pos, dst_pos;
@@ -1900,9 +1857,9 @@ 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)
-     re_match_context_t *mctx;
-     int boundaries, subexp_idx, from_node, bkref_idx;
+internal_function
+check_dst_limits_calc_pos_1 (re_match_context_t *mctx, int boundaries,
+                            int subexp_idx, int from_node, int bkref_idx)
 {
   re_dfa_t *const dfa = mctx->dfa;
   re_node_set *eclosures = dfa->eclosures + from_node;
@@ -1978,9 +1935,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)
-     re_match_context_t *mctx;
-     int limit, subexp_idx, from_node, str_idx, bkref_idx;
+internal_function
+check_dst_limits_calc_pos (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;
@@ -2007,13 +1964,10 @@ 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)
-     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;
+internal_function
+check_subexp_limits (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;
@@ -2098,11 +2052,9 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx)
 }
 
 static reg_errcode_t
-sift_states_bkref (mctx, sctx, str_idx, candidates)
-     re_match_context_t *mctx;
-     re_sift_context_t *sctx;
-     int str_idx;
-     const re_node_set *candidates;
+internal_function
+sift_states_bkref (re_match_context_t *mctx, re_sift_context_t *sctx,
+                  int str_idx, const re_node_set *candidates)
 {
   re_dfa_t *const dfa = mctx->dfa;
   reg_errcode_t err;
@@ -2197,10 +2149,9 @@ 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;
+internal_function
+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)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int naccepted;
@@ -2228,10 +2179,9 @@ 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;
+internal_function
+transit_state (reg_errcode_t *err, re_match_context_t *mctx,
+              re_dfastate_t *state)
 {
   re_dfastate_t **trtable;
   unsigned char ch;
@@ -2287,10 +2237,9 @@ 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;
+internal_function
+merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
+                     re_dfastate_t *next_state)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int cur_idx = re_string_cur_idx (&mctx->input);
@@ -2366,10 +2315,9 @@ merge_state_with_log (err, mctx, next_state)
 /* Skip bytes in the input that correspond to part of a
    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;
+static re_dfastate_t *
+internal_function
+find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
 {
   re_dfastate_t *cur_state = NULL;
   do
@@ -2399,10 +2347,9 @@ 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;
+internal_function
+check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes,
+                          int str_idx)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int node_idx;
@@ -2474,9 +2421,8 @@ 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;
+internal_function
+transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate)
 {
   re_dfa_t *const dfa = mctx->dfa;
   reg_errcode_t err;
@@ -2544,9 +2490,8 @@ 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;
+internal_function
+transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
 {
   re_dfa_t *const dfa = mctx->dfa;
   reg_errcode_t err;
@@ -2659,9 +2604,8 @@ 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;
+internal_function
+get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int subexp_num, sub_top_idx;
@@ -2805,11 +2749,9 @@ 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;
+internal_function
+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;
@@ -2835,10 +2777,9 @@ 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;
+internal_function
+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)
@@ -2858,11 +2799,10 @@ 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;
+internal_function
+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)
 {
   re_dfa_t *const dfa = mctx->dfa;
   reg_errcode_t err;
@@ -3020,10 +2960,10 @@ 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;
+internal_function
+check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx,
+                             re_node_set *cur_nodes,
+                             re_node_set *next_nodes)
 {
   re_dfa_t *const dfa = mctx->dfa;
   int result;
@@ -3100,10 +3040,9 @@ 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)
-     re_dfa_t *dfa;
-     re_node_set *cur_nodes;
-     int ex_subexp, type;
+internal_function
+check_arrival_expand_ecl (re_dfa_t *dfa, re_node_set *cur_nodes,
+                         int ex_subexp, int type)
 {
   reg_errcode_t err;
   int idx, outside_node;
@@ -3154,10 +3093,9 @@ 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)
-     re_dfa_t *dfa;
-     int target, ex_subexp, type;
-     re_node_set *dst_nodes;
+internal_function
+check_arrival_expand_ecl_sub (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);)
@@ -3199,11 +3137,9 @@ 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;
+internal_function
+expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes,
+                   int cur_str, int subexp_num, int type)
 {
   re_dfa_t *const dfa = mctx->dfa;
   reg_errcode_t err;
@@ -3290,9 +3226,8 @@ expand_bkref_cache (mctx, cur_nodes, cur_str, subexp_num,
    Return 1 if succeeded, otherwise return NULL.  */
 
 static int
-build_trtable (dfa, state)
-    re_dfa_t *dfa;
-    re_dfastate_t *state;
+internal_function
+build_trtable (re_dfa_t *dfa, re_dfastate_t *state)
 {
   reg_errcode_t err;
   int i, j, ch, need_word_trtable = 0;
@@ -3516,11 +3451,9 @@ 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)
-    re_dfa_t *dfa;
-    const re_dfastate_t *state;
-    re_node_set *dests_node;
-    bitset *dests_ch;
+internal_function
+group_nodes_into_DFAstates (re_dfa_t *dfa, const re_dfastate_t *state,
+                           re_node_set *dests_node, bitset *dests_ch)
 {
   reg_errcode_t err;
   int result;
@@ -3708,10 +3641,9 @@ 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)
-    re_dfa_t *dfa;
-    int node_idx, str_idx;
-    const re_string_t *input;
+internal_function
+check_node_accept_bytes (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;
@@ -4009,10 +3941,9 @@ 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;
+internal_function
+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);
@@ -4060,8 +3991,8 @@ 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;
+internal_function
+extend_buffers (re_match_context_t *mctx)
 {
   reg_errcode_t ret;
   re_string_t *pstr = &mctx->input;
@@ -4119,9 +4050,8 @@ extend_buffers (mctx)
 /* Initialize MCTX.  */
 
 static reg_errcode_t
-match_ctx_init (mctx, eflags, n)
-    re_match_context_t *mctx;
-    int eflags, n;
+internal_function
+match_ctx_init (re_match_context_t *mctx, int eflags, int n)
 {
   mctx->eflags = eflags;
   mctx->match_last = -1;
@@ -4148,8 +4078,8 @@ 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;
+internal_function
+match_ctx_clean (re_match_context_t *mctx)
 {
   int st_idx;
   for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx)
@@ -4178,8 +4108,8 @@ match_ctx_clean (mctx)
 /* Free all the memory associated with MCTX.  */
 
 static void
-match_ctx_free (mctx)
-    re_match_context_t *mctx;
+internal_function
+match_ctx_free (re_match_context_t *mctx)
 {
   /* First, free all the memory associated with MCTX->SUB_TOPS.  */
   match_ctx_clean (mctx);
@@ -4193,9 +4123,9 @@ 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;
+internal_function
+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)
     {
@@ -4242,9 +4172,8 @@ 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)
-     re_match_context_t *mctx;
-     int str_idx;
+internal_function
+search_cur_bkref_entry (re_match_context_t *mctx, int str_idx)
 {
   int left, right, mid, last;
   last = right = mctx->nbkref_ents;
@@ -4266,9 +4195,8 @@ 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;
+internal_function
+match_ctx_add_subtop (re_match_context_t *mctx, int node, int str_idx)
 {
 #ifdef DEBUG
   assert (mctx->sub_tops != NULL);
@@ -4297,9 +4225,8 @@ 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;
+internal_function
+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))
@@ -4325,10 +4252,11 @@ 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;
+internal_function
+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;