OSDN Git Service

adapt regex to new regex.h
authorPeter S. Mazinger <ps.m@gmx.net>
Sun, 27 Mar 2011 00:54:39 +0000 (01:54 +0100)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Fri, 15 Jun 2012 12:00:34 +0000 (14:00 +0200)
While there, add some defines to help build, cleanup

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/misc/regex/regcomp.c
libc/misc/regex/regex.c
libc/misc/regex/regex_internal.c
libc/misc/regex/regex_internal.h
libc/misc/regex/regexec.c

index b25850c..b63f115 100644 (file)
@@ -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)
index fa46f63..e097d9a 100644 (file)
 # 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.  */
index c6ac8dd..3504d78 100644 (file)
@@ -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;
index 0a255e3..4836946 100644 (file)
@@ -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.  */
index c13c64e..106231d 100644 (file)
@@ -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;