about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-06-12 18:29:52 +0000
committerUlrich Drepper <drepper@redhat.com>2003-06-12 18:29:52 +0000
commit66b110e855159d415b5106ade7fa5bf17c14f108 (patch)
tree0274cefb5c078cdf16b0b936d5ace089a724faaa
parent3bbbaea9745d5daa8662feb68f743c7eb2aa80ea (diff)
downloadglibc-66b110e855159d415b5106ade7fa5bf17c14f108.tar.gz
glibc-66b110e855159d415b5106ade7fa5bf17c14f108.tar.xz
glibc-66b110e855159d415b5106ade7fa5bf17c14f108.zip
Update.
2003-06-12  H.J. Lu  <hongjiu.lu@intel.com>

	* posix/transbug.c (run_test): Return 1 for failure.
	(do_test): Compare only if run_test is successful.

2003-06-12  Simon Josefsson  <jas@extundo.com>

	* argp/argp.h [!__THROW]: Define if undefined.

	* posix/transbug.c: New file.
	* inet/Makefile (aux): Add check_pf.
	* include/ifaddrs.h: Add prototype for __check_pf.
	* sysdeps/generic/check_pf.c: New file.
	* sysdeps/unix/sysv/linux/check_pf.c: New file.
-rw-r--r--ChangeLog19
-rw-r--r--argp/argp.h4
-rw-r--r--posix/regcomp.c38
-rw-r--r--posix/regexec.c17
-rwxr-xr-xposix/transbug.c20
5 files changed, 63 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f20619576..aa7f235172 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-06-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* posix/transbug.c (run_test): Return 1 for failure.
+	(do_test): Compare only if run_test is successful.
+
+2003-06-12  Simon Josefsson  <jas@extundo.com>
+
+	* argp/argp.h [!__THROW]: Define if undefined.
+
 2003-06-12  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/cris/sysdep.h: Fix handling of syscalls with
@@ -22,7 +31,7 @@
 	build_word_op, and build_charclass.
 	(build_charclass): Apply translation for character classes too.
 	(build_word_op): Deliver translation to build_charclass.
-	* posux/transbug.c: New file.
+	* posix/transbug.c: New file.
 	* posix/Makefile (tests): Add transbug.
 
 2003-06-04  Paolo Bonzini  <bonzini@gnu.org>
@@ -193,10 +202,10 @@
 
 2003-06-10  Ulrich Drepper  <drepper@redhat.com>
 
-	* inet/Makefile (aux): Add check_fd.
-	* include/ifaddrs.h: Add prototype for __check_fd.
-	* sysdeps/generic/check_fd.c: New file.
-	* sysdeps/unix/sysv/linux/check_fd.c: New file.
+	* inet/Makefile (aux): Add check_pf.
+	* include/ifaddrs.h: Add prototype for __check_pf.
+	* sysdeps/generic/check_pf.c: New file.
+	* sysdeps/unix/sysv/linux/check_pf.c: New file.
 	* sysdeps/unix/sysv/linux/ifaddrs.h (__no_netlink_support): Renamed
 	from no_netlink_support.  Export.
 	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Don't call getifaddrs,
diff --git a/argp/argp.h b/argp/argp.h
index 04b4e92806..564db5515a 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -32,6 +32,10 @@
 # define __const const
 #endif
 
+#ifndef __THROW
+# define __THROW
+#endif
+
 #ifndef __error_t_defined
 typedef int error_t;
 # define __error_t_defined
diff --git a/posix/regcomp.c b/posix/regcomp.c
index f25ecae5fd..007bd77cab 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -104,7 +104,8 @@ static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset,
 					re_charset_t *mbcset,
 					int *equiv_class_alloc,
 					const unsigned char *name);
-static reg_errcode_t build_charclass (re_bitset_ptr_t sbcset,
+static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
+				      re_bitset_ptr_t sbcset,
 				      re_charset_t *mbcset,
 				      int *char_class_alloc,
 				      const unsigned char *class_name,
@@ -112,11 +113,13 @@ static reg_errcode_t build_charclass (re_bitset_ptr_t sbcset,
 #else  /* not RE_ENABLE_I18N */
 static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset,
 					const unsigned char *name);
-static reg_errcode_t build_charclass (re_bitset_ptr_t sbcset,
+static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
+				      re_bitset_ptr_t sbcset,
 				      const unsigned char *class_name,
 				      reg_syntax_t syntax);
 #endif /* not RE_ENABLE_I18N */
-static bin_tree_t *build_word_op (re_dfa_t *dfa, int not, reg_errcode_t *err);
+static bin_tree_t *build_word_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
+				  int not, reg_errcode_t *err);
 static void free_bin_tree (bin_tree_t *tree);
 static bin_tree_t *create_tree (bin_tree_t *left, bin_tree_t *right,
 				re_token_type_t type, int index);
@@ -2073,12 +2076,12 @@ parse_expression (regexp, preg, token, syntax, nest, err)
 	dfa->has_mb_node = 1;
       break;
     case OP_WORD:
-      tree = build_word_op (dfa, 0, err);
+      tree = build_word_op (dfa, regexp->trans, 0, err);
       if (BE (*err != REG_NOERROR && tree == NULL, 0))
 	return NULL;
       break;
     case OP_NOTWORD:
-      tree = build_word_op (dfa, 1, err);
+      tree = build_word_op (dfa, regexp->trans, 1, err);
       if (BE (*err != REG_NOERROR && tree == NULL, 0))
 	return NULL;
       break;
@@ -2949,7 +2952,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
 		goto parse_bracket_exp_free_return;
 	      break;
 	    case CHAR_CLASS:
-	      *err = build_charclass (sbcset,
+	      *err = build_charclass (regexp->trans, sbcset,
 #ifdef RE_ENABLE_I18N
 				      mbcset, &char_class_alloc,
 #endif /* RE_ENABLE_I18N */
@@ -3200,12 +3203,13 @@ build_equiv_class (sbcset, name)
 
 static reg_errcode_t
 #ifdef RE_ENABLE_I18N
-build_charclass (sbcset, mbcset, char_class_alloc, class_name, syntax)
+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 (sbcset, class_name, syntax)
+build_charclass (trans, sbcset, class_name, syntax)
 #endif /* not RE_ENABLE_I18N */
+     RE_TRANSLATE_TYPE trans;
      re_bitset_ptr_t sbcset;
      const unsigned char *class_name;
      reg_syntax_t syntax;
@@ -3235,11 +3239,14 @@ build_charclass (sbcset, class_name, syntax)
   mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
 #endif /* RE_ENABLE_I18N */
 
-#define BUILD_CHARCLASS_LOOP(ctype_func)\
-    for (i = 0; i < SBC_MAX; ++i)	\
-      {					\
-	if (ctype_func (i))		\
-	  bitset_set (sbcset, i);	\
+#define BUILD_CHARCLASS_LOOP(ctype_func)	\
+    for (i = 0; i < SBC_MAX; ++i)		\
+      {						\
+	if (ctype_func (i))			\
+	  {					\
+	    int ch = trans ? trans[i] : i;	\
+	    bitset_set (sbcset, ch);		\
+	  }					\
       }
 
   if (strcmp (name, "alnum") == 0)
@@ -3273,8 +3280,9 @@ build_charclass (sbcset, class_name, syntax)
 }
 
 static bin_tree_t *
-build_word_op (dfa, not, err)
+build_word_op (dfa, trans, not, err)
      re_dfa_t *dfa;
+     RE_TRANSLATE_TYPE trans;
      int not;
      reg_errcode_t *err;
 {
@@ -3324,7 +3332,7 @@ build_word_op (dfa, not, err)
     }
 
   /* We don't care the syntax in this case.  */
-  ret = build_charclass (sbcset,
+  ret = build_charclass (trans, sbcset,
 #ifdef RE_ENABLE_I18N
 			 mbcset, &alloc,
 #endif /* RE_ENABLE_I18N */
diff --git a/posix/regexec.c b/posix/regexec.c
index 6ea14a6c48..9ade27ada8 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -3334,12 +3334,6 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch)
 	 match it the context.  */
       if (constraint)
 	{
-	  if (constraint & NEXT_WORD_CONSTRAINT)
-	    for (j = 0; j < BITSET_UINTS; ++j)
-	      accepts[j] &= dfa->word_char[j];
-	  if (constraint & NEXT_NOTWORD_CONSTRAINT)
-	    for (j = 0; j < BITSET_UINTS; ++j)
-	      accepts[j] &= ~dfa->word_char[j];
 	  if (constraint & NEXT_NEWLINE_CONSTRAINT)
 	    {
 	      int accepts_newline = bitset_contain (accepts, NEWLINE_CHAR);
@@ -3349,6 +3343,17 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch)
 	      else
 		continue;
 	    }
+	  if (constraint & NEXT_ENDBUF_CONSTRAINT)
+	    {
+	      bitset_empty (accepts);
+	      continue;
+	    }
+	  if (constraint & NEXT_WORD_CONSTRAINT)
+	    for (j = 0; j < BITSET_UINTS; ++j)
+	      accepts[j] &= dfa->word_char[j];
+	  if (constraint & NEXT_NOTWORD_CONSTRAINT)
+	    for (j = 0; j < BITSET_UINTS; ++j)
+	      accepts[j] &= ~dfa->word_char[j];
 	}
 
       /* Then divide `accepts' into DFA states, or create a new
diff --git a/posix/transbug.c b/posix/transbug.c
index 8bfbe8fafd..434674fd55 100755
--- a/posix/transbug.c
+++ b/posix/transbug.c
@@ -105,7 +105,7 @@ run_test (const char *pattern, struct re_registers *regs)
     printf ("search 2: res = %d, start = %d, end = %d\n",
 	    res, regs[1].start[0], regs[1].end[0]);
 
-  return 0;
+  return res < 0 ? 1 : 0;
 }
 
 
@@ -120,17 +120,19 @@ do_test (void)
 
   (void) re_set_syntax (RE_SYNTAX_GNU_AWK);
 
-  run_test (lower, regs);
-  run_test (upper, &regs[2]);
-
-  int result = 0;
+  int result;
 #define CHECK(exp) \
   if (exp) { puts (#exp); result = 1; }
 
-  CHECK (regs[0].start[0] != regs[2].start[0]);
-  CHECK (regs[0].end[0] != regs[2].end[0]);
-  CHECK (regs[1].start[0] != regs[3].start[0]);
-  CHECK (regs[1].end[0] != regs[3].end[0]);
+  result = run_test (lower, regs);
+  result |= run_test (upper, &regs[2]);
+  if (! result)
+    {
+      CHECK (regs[0].start[0] != regs[2].start[0]);
+      CHECK (regs[0].end[0] != regs[2].end[0]);
+      CHECK (regs[1].start[0] != regs[3].start[0]);
+      CHECK (regs[1].end[0] != regs[3].end[0]);
+    }
 
   return result;
 }