summary refs log tree commit diff
path: root/posix/regex_internal.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-01-02 21:20:51 +0000
committerUlrich Drepper <drepper@redhat.com>2004-01-02 21:20:51 +0000
commit56b168be5d3d56f8a729acfb5072e0eca429157e (patch)
tree537ab5c65188e2890f815df6ab720f1f7895ffa6 /posix/regex_internal.h
parent8503c987b63bd8badff1e4c9286949b025cecdb3 (diff)
downloadglibc-56b168be5d3d56f8a729acfb5072e0eca429157e.tar.gz
glibc-56b168be5d3d56f8a729acfb5072e0eca429157e.tar.xz
glibc-56b168be5d3d56f8a729acfb5072e0eca429157e.zip
Update.
2004-01-02  Jakub Jelinek  <jakub@redhat.com>

	* posix/regex_internal.c (re_node_set_insert): Remove unused variables.

	* posix/regex_internal.h (re_dfa_t): Add syntax field.
	* posix/regcomp.c (parse): Initialize dfa->syntax.
	* posix/regexec.c (acquire_init_state_context,
	prune_impossible_nodes, check_matching, check_halt_state_context,
	proceed_next_node, sift_states_iter_mb, sift_states_backward,
	update_cur_sifted_state, sift_states_bkref, transit_state,
	transit_state_sb, transit_state_mb, transit_state_bkref,
	get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache,
	build_trtable): Remove preg argument, add dfa argument instead
	and remove dfa = preg->buffer initialization in the body.
	Adjust all callers.
	(check_node_accept_bytes, group_nodes_into_DFAstates,
	check_node_accept): Likewise.  Use dfa->syntax instead of
	preg->syntax.
	(check_arrival_add_next_nodes): Remove preg argument.

	* posix/regex_internal.h (re_match_context_t): Make input
	re_string_t instead of a pointer to it.
	* posix/regex_internal.c (re_string_construct_common): Don't clear
	pstr here...
	(re_string_construct): ... but only here.
	* posix/regexec.c (match_ctx_init): Remove input argument.  Don't
	initialize fields to zero.
	(re_search_internal): Move input into mctx.input.
	(acquire_init_state_context, check_matching,
	check_halt_state_context, proceed_next_node,
	clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb,
	transit_state, transit_state_sb, transit_state_mb,
	transit_state_bkref, get_subexp, check_arrival,
	check_arrival_add_next_nodes, check_node_accept, extend_buffers):
	Change mctx->input into &mctx->input and mctx->input->field into
	mctx->input.field.

2004-01-02  Jakub Jelinek  <jakub@redhat.com>
	    Paolo Bonzini  <bonzini@gnu.org>

	* posix/regex_internal.h (re_const_bitset_ptr_t): New type.
	(re_string_t): Add newline_anchor, word_char and word_ops_used fields.
	(re_dfa_t): Change word_char type to bitset.  Add word_ops_used field.
	(re_string_context_at, re_string_reconstruct): Remove last argument.
	* posix/regex_internal.c (re_string_allocate): Initialize
	pstr->word_char and pstr->word_ops_used.
	(re_string_context_at): Remove newline_anchor argument.
	Use input->newline_anchor instead, swap && conditions.
	Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0.
	Use input->word_char bitmap instead of IS_WORD_CHAR.
	(re_string_reconstruct): Likewise.
	Adjust re_string_context_at caller.
	* posix/regexec.c (acquire_init_state_context,
	check_halt_state_context, transit_state, transit_state_sb,
	transit_state_mb, transit_state_bkref, check_arrival,
	check_node_accept): Adjust re_string_context_at and
	re_string_reconstruct callers.
	(re_search_internal): Likewise.  Set input.newline_anchor.
	(build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR.
	* posix/regcomp.c (init_word_char): Change return type to void.
	Set dfa->word_ops_used.
	(free_dfa_content): Don't free dfa->word_char.
	(parse_expression): Remove error handling for init_word_char.
Diffstat (limited to 'posix/regex_internal.h')
-rw-r--r--posix/regex_internal.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index c2824ed977..8113914925 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -121,6 +121,7 @@ extern const size_t __re_error_msgid_idx[] attribute_hidden;
 #define BITSET_UINTS ((SBC_MAX + UINT_BITS - 1) / UINT_BITS)
 typedef unsigned int bitset[BITSET_UINTS];
 typedef unsigned int *re_bitset_ptr_t;
+typedef const unsigned int *re_const_bitset_ptr_t;
 
 #define bitset_set(set,i) (set[i / UINT_BITS] |= 1 << i % UINT_BITS)
 #define bitset_clear(set,i) (set[i / UINT_BITS] &= ~(1 << i % UINT_BITS))
@@ -337,12 +338,16 @@ struct re_string_t
   unsigned int tip_context;
   /* The translation passed as a part of an argument of re_compile_pattern.  */
   RE_TRANSLATE_TYPE trans;
+  /* Copy of re_dfa_t's word_char.  */
+  re_const_bitset_ptr_t word_char;
   /* 1 if REG_ICASE.  */
   unsigned char icase;
   unsigned char is_utf8;
   unsigned char map_notascii;
   unsigned char mbs_allocated;
   unsigned char offsets_needed;
+  unsigned char newline_anchor;
+  unsigned char word_ops_used;
   int mb_cur_max;
 };
 typedef struct re_string_t re_string_t;
@@ -363,14 +368,17 @@ typedef struct re_dfa_t re_dfa_t;
 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) internal_function;
+					 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) internal_function;
+					  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) internal_function;
+					    int eflags) internal_function;
 static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
-						int new_buf_len) internal_function;
+						int new_buf_len)
+     internal_function;
 # 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;
@@ -379,15 +387,19 @@ 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) 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;
+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) internal_function;
+					  int eflags) internal_function;
 static unsigned char re_string_peek_byte_case (const re_string_t *pstr,
 					       int idx) internal_function;
-static unsigned char re_string_fetch_byte_case (re_string_t *pstr) 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])
@@ -471,7 +483,7 @@ struct re_dfastate_t
   re_node_set nodes;
   re_node_set *entrance_nodes;
   struct re_dfastate_t **trtable;
-  unsigned int context : 10;
+  unsigned int context : 4;
   unsigned int halt : 1;
   /* If this state can accept `multi byte'.
      Note that we refer to multibyte characters, and multi character
@@ -542,13 +554,13 @@ struct re_backref_cache_entry
 
 typedef struct
 {
+  /* The string object corresponding to the input string.  */
+  re_string_t input;
   /* EFLAGS of the argument of regexec.  */
   int eflags;
   /* Where the matching ends.  */
   int match_last;
   int last_node;
-  /* The string object corresponding to the input string.  */
-  re_string_t *input;
   /* The state log used by the matcher.  */
   re_dfastate_t **state_log;
   int state_log_top;
@@ -594,7 +606,6 @@ struct re_fail_stack_t
 
 struct re_dfa_t
 {
-  re_bitset_ptr_t word_char;
   re_subexp_t *subexps;
   re_token_t *nodes;
   int nodes_alloc;
@@ -629,7 +640,10 @@ struct re_dfa_t
   unsigned int has_mb_node : 1;
   unsigned int is_utf8 : 1;
   unsigned int map_notascii : 1;
+  unsigned int word_ops_used : 1;
   int mb_cur_max;
+  bitset word_char;
+  reg_syntax_t syntax;
 #ifdef DEBUG
   char* re_str;
 #endif