diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-01-07 02:32:27 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-01-07 02:32:27 +0000 |
commit | e523bd15353350c3480b8a1820a0944b0fa8212e (patch) | |
tree | 60485116f9c62c306bb753f12f9d4eb79d16aa4e /libc/misc/regex | |
parent | 3b3434516a3415d7e0f4e1d50c553876dcb337b2 (diff) | |
download | uClibc-alpine-e523bd15353350c3480b8a1820a0944b0fa8212e.tar.bz2 uClibc-alpine-e523bd15353350c3480b8a1820a0944b0fa8212e.tar.xz |
Big fricking merge from trunk.
Diffstat (limited to 'libc/misc/regex')
-rw-r--r-- | libc/misc/regex/regcomp.c | 9 | ||||
-rw-r--r-- | libc/misc/regex/regex.c | 3 | ||||
-rw-r--r-- | libc/misc/regex/regex_internal.c | 4 | ||||
-rw-r--r-- | libc/misc/regex/regex_internal.h | 2 | ||||
-rw-r--r-- | libc/misc/regex/regex_old.c | 40 |
5 files changed, 39 insertions, 19 deletions
diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c index 83df61108..419d879be 100644 --- a/libc/misc/regex/regcomp.c +++ b/libc/misc/regex/regcomp.c @@ -292,7 +292,7 @@ re_set_fastmap (char *fastmap, int icase, int ch) { fastmap[ch] = 1; if (icase) - fastmap[tolower (ch)] = 1; + fastmap[__tolower (ch)] = 1; } /* Helper function for re_compile_fastmap. @@ -833,7 +833,14 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); dfa->state_hash_mask = table_size - 1; +#ifdef __UCLIBC_HAS_WCHAR__ +# undef MB_CUR_MAX +# define MB_CUR_MAX (_stdlib_mb_cur_max_internal ()) +extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; dfa->mb_cur_max = MB_CUR_MAX; +#else + dfa->mb_cur_max = 1; +#endif #ifdef _LIBC if (dfa->mb_cur_max == 6 && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0) diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 5220ba57c..99de9fd6c 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -38,6 +38,9 @@ #define iswctype __iswctype #define iswlower __iswlower #define iswalnum __iswalnum +#define towlower __towlower +#define towupper __towupper +#define mbsinit __mbsinit #include <wchar.h> #include <wctype.h> diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c index f9814d290..c1ee85040 100644 --- a/libc/misc/regex/regex_internal.c +++ b/libc/misc/regex/regex_internal.c @@ -289,7 +289,7 @@ build_wcs_upper_buffer (re_string_t *pstr) { /* In case of a singlebyte character. */ pstr->mbs[byte_idx] - = toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]); + = __toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]); /* The next step uses the assumption that wchar_t is encoded ASCII-safe: all ASCII values can be converted like this. */ pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx]; @@ -523,7 +523,7 @@ build_upper_buffer (re_string_t *pstr) if (BE (pstr->trans != NULL, 0)) ch = pstr->trans[ch]; if (islower (ch)) - pstr->mbs[char_idx] = toupper (ch); + pstr->mbs[char_idx] = __toupper (ch); else pstr->mbs[char_idx] = ch; } diff --git a/libc/misc/regex/regex_internal.h b/libc/misc/regex/regex_internal.h index 14d14da3c..4782883c1 100644 --- a/libc/misc/regex/regex_internal.h +++ b/libc/misc/regex/regex_internal.h @@ -670,7 +670,9 @@ typedef struct { unsigned char ch; unsigned char *name; +#ifdef __UCLIBC_HAS_WCHAR__ wchar_t wch; +#endif } opr; } bracket_elem_t; diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 6bb319acd..9031cebff 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -35,12 +35,15 @@ #define iswctype __iswctype #define iswalnum __iswalnum #define printf __printf +#define btowc __btowc /* To exclude some unwanted junk.... */ -#undef _LIBC #undef emacs #define _REGEX_RE_COMP #include <features.h> +#ifdef __UCLIBC__ +# undef _LIBC +#endif #include <stdlib.h> #include <string.h> #define STDC_HEADERS @@ -88,7 +91,7 @@ extern void *__mempcpy (void *__restrict __dest, # include <wctype.h> # endif -# ifdef _LIBC +# if defined _LIBC || defined __UCLIBC__ /* We have to keep the namespace clean. */ # define regfree(preg) __regfree (preg) # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef) @@ -113,11 +116,13 @@ extern void *__mempcpy (void *__restrict __dest, # define btowc __btowc /* We are also using some library internals. */ +# ifndef __UCLIBC__ # include <locale/localeinfo.h> # include <locale/elem-hash.h> # include <langinfo.h> # include <locale/coll-lookup.h> # endif +# endif /* This is for other GNU distributions with internationalized messages. */ # if HAVE_LIBINTL_H || defined _LIBC @@ -217,6 +222,9 @@ char *realloc (); # endif /* Get the interface, including the syntax bits. */ +# ifdef __UCLIBC__ +# include "_regex.h" +# endif # include <regex.h> /* isalpha etc. are used for the character classes. */ @@ -267,7 +275,7 @@ char *realloc (); # ifdef _tolower # define TOLOWER(c) _tolower(c) # else -# define TOLOWER(c) tolower(c) +# define TOLOWER(c) __tolower(c) # endif # ifndef NULL @@ -1380,7 +1388,7 @@ re_set_syntax (syntax) # endif /* DEBUG */ return ret; } -# ifdef _LIBC +# if defined _LIBC || defined __UCLIBC__ weak_alias (__re_set_syntax, re_set_syntax) # endif @@ -5000,7 +5008,7 @@ re_compile_fastmap (bufp) # endif return byte_re_compile_fastmap(bufp); } /* re_compile_fastmap */ -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__re_compile_fastmap, re_compile_fastmap) #endif @@ -5039,7 +5047,7 @@ re_set_registers (bufp, regs, num_regs, starts, ends) regs->start = regs->end = (regoff_t *) 0; } } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__re_set_registers, re_set_registers) #endif @@ -5058,7 +5066,7 @@ re_search (bufp, string, size, startpos, range, regs) return re_search_2 (bufp, NULL, 0, string, size, startpos, range, regs, size); } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__re_search, re_search) #endif @@ -5103,7 +5111,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop); } /* re_search_2 */ -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__re_search_2, re_search_2) #endif @@ -5562,7 +5570,7 @@ re_match (bufp, string, size, pos, regs) # endif return result; } -# ifdef _LIBC +# if defined _LIBC || defined __UCLIBC__ weak_alias (__re_match, re_match) # endif #endif /* not emacs */ @@ -5623,7 +5631,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) #endif return result; } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__re_match_2, re_match_2) #endif @@ -7962,7 +7970,7 @@ re_compile_pattern (pattern, length, bufp) return NULL; return gettext (re_error_msgid + re_error_msgid_idx[(int) ret]); } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__re_compile_pattern, re_compile_pattern) #endif @@ -8029,7 +8037,7 @@ re_comp (s) int -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_function #endif re_exec (s) @@ -8158,7 +8166,7 @@ regcomp (preg, pattern, cflags) return (int) ret; } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__regcomp, regcomp) #endif @@ -8236,7 +8244,7 @@ regexec (preg, string, nmatch, pmatch, eflags) /* We want zero return to mean success, unlike `re_search'. */ return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__regexec, regexec) #endif @@ -8284,7 +8292,7 @@ regerror (errcode, preg, errbuf, errbuf_size) return msg_size; } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__regerror, regerror) #endif @@ -8311,7 +8319,7 @@ regfree (preg) free (preg->translate); preg->translate = NULL; } -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ weak_alias (__regfree, regfree) #endif |