[git commit future 1/1] adapt regex to new regex.h

Khem Raj raj.khem at gmail.com
Sat Mar 19 18:51:25 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=f7cac3a3702b52c9e0cede81ca5c59e2ec4be28c
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

While there, add some defines to help build, cleanup

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 libc/misc/regex/regcomp.c        |   12 ++++++------
 libc/misc/regex/regex.c          |    8 ++++++++
 libc/misc/regex/regex_internal.c |    8 ++++----
 libc/misc/regex/regex_internal.h |    3 +--
 libc/misc/regex/regexec.c        |    2 +-
 5 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c
index b25850c..b63f115 100644
--- a/libc/misc/regex/regcomp.c
+++ b/libc/misc/regex/regcomp.c
@@ -91,7 +91,7 @@ static reg_errcode_t build_equiv_class (bitset_t sbcset,
 					re_charset_t *mbcset,
 					int *equiv_class_alloc,
 					const unsigned char *name);
-static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
+static reg_errcode_t build_charclass (__RE_TRANSLATE_TYPE trans,
 				      bitset_t sbcset,
 				      re_charset_t *mbcset,
 				      int *char_class_alloc,
@@ -100,13 +100,13 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
 #else  /* not RE_ENABLE_I18N */
 static reg_errcode_t build_equiv_class (bitset_t sbcset,
 					const unsigned char *name);
-static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
+static reg_errcode_t build_charclass (__RE_TRANSLATE_TYPE trans,
 				      bitset_t sbcset,
 				      const unsigned char *class_name,
 				      reg_syntax_t syntax);
 #endif /* not RE_ENABLE_I18N */
 static bin_tree_t *build_charclass_op (re_dfa_t *dfa,
-				       RE_TRANSLATE_TYPE trans,
+				       __RE_TRANSLATE_TYPE trans,
 				       const unsigned char *class_name,
 				       const unsigned char *extra,
 				       int non_match, reg_errcode_t *err);
@@ -3414,11 +3414,11 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
 
 static reg_errcode_t
 #ifdef RE_ENABLE_I18N
-build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
+build_charclass (__RE_TRANSLATE_TYPE trans, bitset_t sbcset,
 		 re_charset_t *mbcset, int *char_class_alloc,
 		 const unsigned char *class_name, reg_syntax_t syntax)
 #else
-build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
+build_charclass (__RE_TRANSLATE_TYPE trans, bitset_t sbcset,
 		 const unsigned char *class_name, reg_syntax_t syntax)
 #endif
 {
@@ -3496,7 +3496,7 @@ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
 }
 
 static bin_tree_t *
-build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
+build_charclass_op (re_dfa_t *dfa, __RE_TRANSLATE_TYPE trans,
 		    const unsigned char *class_name,
 		    const unsigned char *extra, int non_match,
 		    reg_errcode_t *err)
diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c
index fa46f63..e097d9a 100644
--- a/libc/misc/regex/regex.c
+++ b/libc/misc/regex/regex.c
@@ -30,7 +30,12 @@
 # include <stdlib.h>
 # ifdef __UCLIBC_HAS_WCHAR__
 #  define RE_ENABLE_I18N
+#  define HAVE_WCHAR_H 1
+#  define HAVE_WCRTOMB 1
+#  define HAVE_MBRTOWC 1
+#  define HAVE_WCSCOLL 1
 #  include <wchar.h>
+#  define HAVE_WCTYPE_H 1
 #  include <wctype.h>
 #  define __iswctype iswctype
 #  define __wcrtomb wcrtomb
@@ -38,6 +43,9 @@
 #  define __wctype wctype
 # endif
 # include <ctype.h>
+# ifdef __UCLIBC_HAS_LOCALE__
+#  define HAVE_LOCALE_H 1
+# endif
 #endif
 
 /* Make sure noone compiles this code with a C++ compiler.  */
diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c
index c6ac8dd..3504d78 100644
--- a/libc/misc/regex/regex_internal.c
+++ b/libc/misc/regex/regex_internal.c
@@ -20,7 +20,7 @@
 
 static void re_string_construct_common (const char *str, int len,
 					re_string_t *pstr,
-					RE_TRANSLATE_TYPE trans, int icase,
+					__RE_TRANSLATE_TYPE trans, int icase,
 					const re_dfa_t *dfa) internal_function;
 static re_dfastate_t *create_ci_newstate (const re_dfa_t *dfa,
 					  const re_node_set *nodes,
@@ -38,7 +38,7 @@ static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa,
 static reg_errcode_t
 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)
+		    __RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
 {
   reg_errcode_t ret;
   int init_buf_len;
@@ -66,7 +66,7 @@ re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
 static reg_errcode_t
 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)
+		     __RE_TRANSLATE_TYPE trans, int icase, const re_dfa_t *dfa)
 {
   reg_errcode_t ret;
   memset (pstr, '\0', sizeof (re_string_t));
@@ -162,7 +162,7 @@ re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
 static void
 internal_function
 re_string_construct_common (const char *str, int len, re_string_t *pstr,
-			    RE_TRANSLATE_TYPE trans, int icase,
+			    __RE_TRANSLATE_TYPE trans, int icase,
 			    const re_dfa_t *dfa)
 {
   pstr->raw_mbs = (const unsigned char *) str;
diff --git a/libc/misc/regex/regex_internal.h b/libc/misc/regex/regex_internal.h
index 0a255e3..4836946 100644
--- a/libc/misc/regex/regex_internal.h
+++ b/libc/misc/regex/regex_internal.h
@@ -23,7 +23,6 @@
 
 #include <assert.h>
 #include <ctype.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -315,7 +314,7 @@ struct re_string_t
      the beginning of the input string.  */
   unsigned int tip_context;
   /* The translation passed as a part of an argument of re_compile_pattern.  */
-  RE_TRANSLATE_TYPE trans;
+  __RE_TRANSLATE_TYPE trans;
   /* Copy of re_dfa_t's word_char.  */
   re_const_bitset_ptr_t word_char;
   /* 1 if REG_ICASE.  */
diff --git a/libc/misc/regex/regexec.c b/libc/misc/regex/regexec.c
index c13c64e..106231d 100644
--- a/libc/misc/regex/regexec.c
+++ b/libc/misc/regex/regexec.c
@@ -564,7 +564,7 @@ re_search_internal (const regex_t *preg, const char *string, int length,
   re_match_context_t mctx;
   char *fastmap = (preg->fastmap != NULL && preg->fastmap_accurate
 		   && range && !preg->can_be_null) ? preg->fastmap : NULL;
-  RE_TRANSLATE_TYPE t = preg->translate;
+  __RE_TRANSLATE_TYPE t = preg->translate;
 
   memset (&mctx, '\0', sizeof (re_match_context_t));
   mctx.dfa = dfa;
-- 
1.7.3.4



More information about the uClibc-cvs mailing list