summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-03-27 01:54:39 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:34 +0200
commit41f937c846d5d106a049094dea67118810d6f4ac (patch)
treed1e1064c7e5145326211046d107db446d4c127d7 /libc/misc
parentef304f14b38a40531af4abd5cd4703cb3483be88 (diff)
adapt regex to new regex.h
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>
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/regex/regcomp.c12
-rw-r--r--libc/misc/regex/regex.c8
-rw-r--r--libc/misc/regex/regex_internal.c8
-rw-r--r--libc/misc/regex/regex_internal.h3
-rw-r--r--libc/misc/regex/regexec.c2
5 files changed, 20 insertions, 13 deletions
diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c
index b25850ccd..b63f115a3 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 fa46f635f..e097d9a37 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 c6ac8dda1..3504d789d 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 0a255e37f..4836946f7 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 c13c64ef4..106231da7 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;