diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-26 04:25:09 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-26 04:25:09 +0000 |
commit | 0ef4c6b76fcaca59014c4d00828d4079314c1700 (patch) | |
tree | 91ccf816a2b3cbe5d95b4501f1d859316d9b4a7b /libc | |
parent | 6eb4415eaaaa2a01209262555f0a115a46deeb36 (diff) |
regex: drop __<funcname> aliases. remove much of unused code.
shrink offset tables. disable "likely/unlikely" BE() macro.
text data bss dec hex filename
- 515032 2731 15424 533187 822c3 lib/libuClibc-0.9.30-svn.so
+ 515014 2731 15424 533169 822b1 lib/libuClibc-0.9.30-svn.so
Diffstat (limited to 'libc')
-rw-r--r-- | libc/misc/regex/_regex.h | 45 | ||||
-rw-r--r-- | libc/misc/regex/regcomp.c | 32 | ||||
-rw-r--r-- | libc/misc/regex/regex.c | 137 | ||||
-rw-r--r-- | libc/misc/regex/regex_internal.h | 30 | ||||
-rw-r--r-- | libc/misc/regex/regex_old.c | 107 | ||||
-rw-r--r-- | libc/misc/regex/regexec.c | 42 |
6 files changed, 52 insertions, 341 deletions
diff --git a/libc/misc/regex/_regex.h b/libc/misc/regex/_regex.h deleted file mode 100644 index 01bb21158..000000000 --- a/libc/misc/regex/_regex.h +++ /dev/null @@ -1,45 +0,0 @@ -/* this file is copied from libc/include/regex.h */ - -#ifndef _REGEX_H -#include <regex.h> - -/* Document internal interfaces. */ -extern reg_syntax_t __re_set_syntax (reg_syntax_t syntax) attribute_hidden; - -extern const char *__re_compile_pattern (const char *pattern, size_t length, - struct re_pattern_buffer *buffer) attribute_hidden; - -extern int __re_compile_fastmap (struct re_pattern_buffer *buffer) attribute_hidden; - -extern int __re_search (struct re_pattern_buffer *buffer, const char *string, - int length, int start, int range, - struct re_registers *regs) attribute_hidden; - -extern int __re_search_2 - (struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, int range, struct re_registers *regs, int stop) attribute_hidden; - -extern int __re_match - (struct re_pattern_buffer *buffer, const char *string, - int length, int start, struct re_registers *regs) attribute_hidden; - -extern int __re_match_2 - (struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, struct re_registers *regs, int stop) attribute_hidden; - -extern void __re_set_registers - (struct re_pattern_buffer *buffer, struct re_registers *regs, - unsigned num_regs, regoff_t *starts, regoff_t *ends) attribute_hidden; - -extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags) attribute_hidden; - -extern int __regexec (const regex_t *__preg, const char *__string, - size_t __nmatch, regmatch_t __pmatch[], int __eflags) attribute_hidden; - -extern size_t __regerror (int __errcode, const regex_t *__preg, - char *__errbuf, size_t __errbuf_size) attribute_hidden; - -extern void __regfree (regex_t *__preg) attribute_hidden; -#endif diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c index 0b3b585ce..8aa152df9 100644 --- a/libc/misc/regex/regcomp.c +++ b/libc/misc/regex/regcomp.c @@ -126,7 +126,7 @@ static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node); POSIX doesn't require that we do anything for REG_NOERROR, but why not be nice? */ -const char __re_error_msgid[] attribute_hidden = +static const char __re_error_msgid[] = { #define REG_NOERROR_IDX 0 gettext_noop ("Success") /* REG_NOERROR */ @@ -180,7 +180,7 @@ const char __re_error_msgid[] attribute_hidden = gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */ }; -const size_t __re_error_msgid_idx[] attribute_hidden = +static const uint16_t __re_error_msgid_idx[] = { REG_NOERROR_IDX, REG_NOMATCH_IDX, @@ -232,9 +232,6 @@ re_compile_pattern (pattern, length, bufp) return NULL; return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]); } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_compile_pattern, re_compile_pattern) -#endif /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own @@ -260,9 +257,6 @@ re_set_syntax (syntax) re_syntax_options = syntax; return ret; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_set_syntax, re_set_syntax) -#endif int re_compile_fastmap (bufp) @@ -282,9 +276,7 @@ re_compile_fastmap (bufp) bufp->fastmap_accurate = 1; return 0; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_compile_fastmap, re_compile_fastmap) -#endif +libc_hidden_def(re_compile_fastmap) static __inline__ void __attribute ((always_inline)) @@ -498,9 +490,6 @@ regcomp (preg, pattern, cflags) return (int) ret; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__regcomp, regcomp) -#endif /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ @@ -532,12 +521,8 @@ regerror (errcode, preg, errbuf, errbuf_size) { if (BE (msg_size > errbuf_size, 0)) { -#if (defined HAVE_MEMPCPY || defined _LIBC) && defined __USE_GNU - *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; -#else memcpy (errbuf, msg, errbuf_size - 1); errbuf[errbuf_size - 1] = 0; -#endif } else memcpy (errbuf, msg, msg_size); @@ -545,9 +530,6 @@ regerror (errcode, preg, errbuf, errbuf_size) return msg_size; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__regerror, regerror) -#endif #ifdef RE_ENABLE_I18N @@ -629,9 +611,7 @@ regfree (preg) re_free (preg->translate); preg->translate = NULL; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__regfree, regfree) -#endif +libc_hidden_def(regfree) /* Entry points compatible with 4.2 BSD regex library. We don't define them unless specifically requested. */ @@ -665,7 +645,7 @@ re_comp (s) { fastmap = re_comp_buf.fastmap; re_comp_buf.fastmap = NULL; - __regfree (&re_comp_buf); + regfree (&re_comp_buf); memset (&re_comp_buf, '\0', sizeof (re_comp_buf)); re_comp_buf.fastmap = fastmap; } @@ -696,7 +676,7 @@ re_comp (s) #ifdef _LIBC libc_freeres_fn (free_mem) { - __regfree (&re_comp_buf); + regfree (&re_comp_buf); } #endif diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 623a3c6bb..edf02a89d 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -18,80 +18,33 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* uClibc addons */ #include <features.h> #ifdef __UCLIBC__ -#undef _LIBC -#define _REGEX_RE_COMP -#ifdef __USE_GNU -# define HAVE_MEMPCPY -#endif -#define HAVE_LANGINFO -#define HAVE_LANGINFO_CODESET -#include <stdbool.h> -#include <stdint.h> -#include <string.h> -#include <stdlib.h> -#ifdef __UCLIBC_HAS_WCHAR__ -#define RE_ENABLE_I18N -#include <wchar.h> -#include <wctype.h> - -#define __iswctype iswctype -#define __wcrtomb wcrtomb -#define __btowc btowc -#define __wctype wctype -/* libc_hidden_proto(wcscoll) */ -/* libc_hidden_proto(wcrtomb) */ -/* libc_hidden_proto(mbrtowc) */ -/* libc_hidden_proto(iswctype) */ -/* libc_hidden_proto(iswlower) */ -/* libc_hidden_proto(iswalnum) */ -/* libc_hidden_proto(towlower) */ -/* libc_hidden_proto(towupper) */ -/* libc_hidden_proto(mbsinit) */ -/* libc_hidden_proto(btowc) */ -/* libc_hidden_proto(wctype) */ - -#endif - -#include <ctype.h> -#ifdef __UCLIBC_HAS_CTYPE_TABLES__ -#define __toupper toupper -#define __tolower tolower -#endif -#define __mempcpy mempcpy -#ifdef __UCLIBC_HAS_XLOCALE__ -/* libc_hidden_proto(__ctype_b_loc) */ -/* libc_hidden_proto(__ctype_toupper_loc) */ -#elif defined __UCLIBC_HAS_CTYPE_TABLES__ -/* libc_hidden_proto(__ctype_b) */ -/* libc_hidden_proto(__ctype_toupper) */ -#else -/* libc_hidden_proto(isascii) */ -#endif -/* libc_hidden_proto(toupper) */ -/* libc_hidden_proto(tolower) */ -/* Experimentally off - libc_hidden_proto(memcmp) */ -/* Experimentally off - libc_hidden_proto(memcpy) */ -/* Experimentally off - libc_hidden_proto(memmove) */ -/* Experimentally off - libc_hidden_proto(memset) */ -/* Experimentally off - libc_hidden_proto(strchr) */ -/* Experimentally off - libc_hidden_proto(strcmp) */ -/* Experimentally off - libc_hidden_proto(strlen) */ -/* Experimentally off - libc_hidden_proto(strncpy) */ -/* libc_hidden_proto(getenv) */ -/* Experimentally off - libc_hidden_proto(strcasecmp) */ -/* libc_hidden_proto(abort) */ -#ifdef __USE_GNU -/* Experimentally off - libc_hidden_proto(mempcpy) */ -#endif - +/* TODO: having _LIBC *off* is very confusing - the rest of uclibc + * has it *on*. Fix it. */ +# undef _LIBC +# define _REGEX_RE_COMP +# define HAVE_LANGINFO +# define HAVE_LANGINFO_CODESET +# include <stdbool.h> +# include <stdint.h> +# include <string.h> +# include <stdlib.h> +# ifdef __UCLIBC_HAS_WCHAR__ +# define RE_ENABLE_I18N +# include <wchar.h> +# include <wctype.h> +# define __iswctype iswctype +# define __wcrtomb wcrtomb +# define __btowc btowc +# define __wctype wctype +# endif +# include <ctype.h> +# ifdef __UCLIBC_HAS_CTYPE_TABLES__ +# define __toupper toupper +# define __tolower tolower +# endif #endif /* Make sure noone compiles this code with a C++ compiler. */ @@ -99,54 +52,14 @@ # error "This is C code, use a C compiler" #endif -#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) -# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags) -# define regerror(errcode, preg, errbuf, errbuf_size) \ - __regerror(errcode, preg, errbuf, errbuf_size) -# define re_set_registers(bu, re, nu, st, en) \ - __re_set_registers (bu, re, nu, st, en) -# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \ - __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) -# define re_match(bufp, string, size, pos, regs) \ - __re_match (bufp, string, size, pos, regs) -# define re_search(bufp, string, size, startpos, range, regs) \ - __re_search (bufp, string, size, startpos, range, regs) -# define re_compile_pattern(pattern, length, bufp) \ - __re_compile_pattern (pattern, length, bufp) -# define re_set_syntax(syntax) __re_set_syntax (syntax) -# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \ - __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) -# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) - -#ifndef __UCLIBC__ -# include "../locale/localeinfo.h" -#endif -#endif - /* On some systems, limits.h sets RE_DUP_MAX to a lower value than GNU regex allows. Include it before <regex.h>, which correctly #undefs RE_DUP_MAX and sets it to the right value. */ #include <limits.h> -#ifdef __UCLIBC__ -#include "_regex.h" -#else #include <regex.h> -#endif -#include "regex_internal.h" +#include "regex_internal.h" #include "regex_internal.c" #include "regcomp.c" #include "regexec.c" - -/* Binary backward compatibility. */ -#if _LIBC -# include <shlib-compat.h> -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3) -link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.") -int re_max_failures = 2000; -# endif -#endif diff --git a/libc/misc/regex/regex_internal.h b/libc/misc/regex/regex_internal.h index f0499caf0..7b95d2e38 100644 --- a/libc/misc/regex/regex_internal.h +++ b/libc/misc/regex/regex_internal.h @@ -29,23 +29,22 @@ #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC # include <langinfo.h> -/* libc_hidden_proto(nl_langinfo) */ #endif #if defined HAVE_LOCALE_H || defined _LIBC # include <locale.h> #endif #if defined HAVE_WCHAR_H || defined _LIBC # include <wchar.h> -#endif /* HAVE_WCHAR_H || _LIBC */ +#endif #if defined HAVE_WCTYPE_H || defined _LIBC # include <wctype.h> -#endif /* HAVE_WCTYPE_H || _LIBC */ +#endif #if defined HAVE_STDBOOL_H || defined _LIBC # include <stdbool.h> -#endif /* HAVE_STDBOOL_H || _LIBC */ +#endif #if defined HAVE_STDINT_H || defined _LIBC # include <stdint.h> -#endif /* HAVE_STDINT_H || _LIBC */ +#endif #if defined _LIBC # include <bits/libc-lock.h> #else @@ -92,7 +91,9 @@ #endif #if __GNUC__ >= 3 -# define BE(expr, val) __builtin_expect (expr, val) +/* uclibc: lean towards smaller size a bit: + * OFF: # define BE(expr, val) __builtin_expect (expr, val) */ +# define BE(expr, val) (expr) #else # define BE(expr, val) (expr) # define inline @@ -112,9 +113,7 @@ # define __wctype wctype # define __iswctype iswctype # define __btowc btowc -# define __mempcpy mempcpy # define __wcrtomb wcrtomb -# define __regfree regfree # define attribute_hidden #endif /* not _LIBC */ @@ -124,9 +123,6 @@ # define __attribute(arg) #endif -extern const char __re_error_msgid[] attribute_hidden; -extern const size_t __re_error_msgid_idx[] attribute_hidden; - /* An integer used to represent a set of bits. It must be unsigned, and must be at least as wide as unsigned int. */ typedef unsigned long int bitset_word_t; @@ -369,18 +365,9 @@ struct re_string_t }; typedef struct re_string_t re_string_t; - struct re_dfa_t; typedef struct re_dfa_t re_dfa_t; -#if !defined _LIBC && !defined __UCLIBC__ -# ifdef __i386__ -# define internal_function __attribute ((regparm (3), stdcall)) -# else -# define internal_function -# endif -#endif - static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, int new_buf_len) internal_function; @@ -752,9 +739,8 @@ re_string_elem_size_at (const re_string_t *pstr, int idx) tmp = findidx (&p); return p - pstr->mbs - idx; } - else # endif /* _LIBC */ - return 1; + return 1; } #endif /* RE_ENABLE_I18N */ diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 6bdd07f14..be93cc028 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -23,12 +23,10 @@ /* To exclude some unwanted junk.... */ #undef emacs #include <features.h> + #ifdef __UCLIBC__ # undef _LIBC # define _REGEX_RE_COMP -# ifdef __USE_GNU -# define HAVE_MEMPCPY -# endif # define STDC_HEADERS # define RE_TRANSLATE_TYPE char * #endif @@ -38,20 +36,9 @@ #include <unistd.h> #include <stdio.h> -/* Experimentally off - libc_hidden_proto(memset) */ -/* Experimentally off - libc_hidden_proto(memcmp) */ -/* Experimentally off - libc_hidden_proto(memcpy) */ -/* Experimentally off - libc_hidden_proto(strcmp) */ -/* Experimentally off - libc_hidden_proto(strlen) */ -/* libc_hidden_proto(printf) */ -/* libc_hidden_proto(abort) */ -#ifdef __USE_GNU -/* Experimentally off - libc_hidden_proto(mempcpy) */ -#endif - /* AIX requires this to be the first thing in the file. */ #if defined _AIX && !defined REGEX_MALLOC - #pragma alloca +# pragma alloca #endif #ifdef HAVE_CONFIG_H @@ -70,43 +57,15 @@ /* For platform which support the ISO C amendement 1 functionality we support user defined character classes. */ -#if defined __UCLIBC_HAS_WCHAR__ +# if defined __UCLIBC_HAS_WCHAR__ # define WIDE_CHAR_SUPPORT 1 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ # include <wchar.h> # include <wctype.h> -/* libc_hidden_proto(wcslen) */ -/* libc_hidden_proto(mbrtowc) */ -/* libc_hidden_proto(wcrtomb) */ -/* libc_hidden_proto(wcscoll) */ -/* libc_hidden_proto(wctype) */ -/* libc_hidden_proto(iswctype) */ -/* libc_hidden_proto(iswalnum) */ -/* libc_hidden_proto(btowc) */ - # endif # 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) -# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags) -# define regerror(errcode, preg, errbuf, errbuf_size) \ - __regerror(errcode, preg, errbuf, errbuf_size) -# define re_set_registers(bu, re, nu, st, en) \ - __re_set_registers (bu, re, nu, st, en) -# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \ - __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) -# define re_match(bufp, string, size, pos, regs) \ - __re_match (bufp, string, size, pos, regs) -# define re_search(bufp, string, size, startpos, range, regs) \ - __re_search (bufp, string, size, startpos, range, regs) -# define re_compile_pattern(pattern, length, bufp) \ - __re_compile_pattern (pattern, length, bufp) -# define re_set_syntax(syntax) __re_set_syntax (syntax) -# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \ - __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) -# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) # ifndef __UCLIBC__ # define btowc __btowc @@ -217,9 +176,6 @@ 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. */ @@ -1366,9 +1322,6 @@ re_set_syntax (reg_syntax_t syntax) # endif /* DEBUG */ return ret; } -# if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_set_syntax, re_set_syntax) -# endif /* This table gives an error message for each of the error codes listed in regex.h. Obviously the order here has to be same as there. @@ -1429,7 +1382,7 @@ static const char re_error_msgid[] = gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */ }; -static const size_t re_error_msgid_idx[] = +static const uint16_t re_error_msgid_idx[] = { REG_NOERROR_IDX, REG_NOMATCH_IDX, @@ -4955,13 +4908,10 @@ re_compile_fastmap (struct re_pattern_buffer *bufp) # ifdef MBS_SUPPORT if (MB_CUR_MAX != 1) return wcs_re_compile_fastmap(bufp); - else # endif - return byte_re_compile_fastmap(bufp); -} /* re_compile_fastmap */ -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_compile_fastmap, re_compile_fastmap) -#endif + return byte_re_compile_fastmap(bufp); +} +libc_hidden_def(re_compile_fastmap) /* Set REGS to hold NUM_REGS registers, storing them in STARTS and @@ -4998,9 +4948,6 @@ re_set_registers ( regs->start = regs->end = (regoff_t *) 0; } } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_set_registers, re_set_registers) -#endif /* Searching routines. */ @@ -5017,9 +4964,6 @@ re_search ( return re_search_2 (bufp, NULL, 0, string, size, startpos, range, regs, size); } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_search, re_search) -#endif /* Using the compiled pattern in BUFP->buffer, first tries to match the @@ -5057,14 +5001,10 @@ re_search_2 ( if (MB_CUR_MAX != 1) return wcs_re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop); - else # endif - return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos, - range, regs, stop); -} /* re_search_2 */ -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_search_2, re_search_2) -#endif + return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos, + range, regs, stop); +} #endif /* not INSIDE_RECURSION */ @@ -5520,9 +5460,6 @@ re_match ( # endif return result; } -# if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_match, re_match) -# endif #endif /* not emacs */ #endif /* not INSIDE_RECURSION */ @@ -5581,9 +5518,6 @@ re_match_2 ( #endif return result; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_match_2, re_match_2) -#endif #endif /* not INSIDE_RECURSION */ @@ -7928,9 +7862,6 @@ re_compile_pattern ( return NULL; return gettext (re_error_msgid + re_error_msgid_idx[(int) ret]); } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_compile_pattern, re_compile_pattern) -#endif /* Entry points compatible with 4.2 BSD regex library. We don't define them unless specifically requested. */ @@ -8122,9 +8053,6 @@ regcomp ( return (int) ret; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__regcomp, regcomp) -#endif /* regexec searches for a given pattern, specified by PREG, in the @@ -8200,9 +8128,7 @@ regexec ( /* We want zero return to mean success, unlike `re_search'. */ return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__regexec, regexec) -#endif +libc_hidden_def(regexec) /* Returns a message corresponding to an error code, ERRCODE, returned @@ -8235,12 +8161,8 @@ regerror ( { if (msg_size > errbuf_size) { -#if (defined HAVE_MEMPCPY || defined _LIBC) && defined __USE_GNU - *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; -#else memcpy (errbuf, msg, errbuf_size - 1); errbuf[errbuf_size - 1] = 0; -#endif } else memcpy (errbuf, msg, msg_size); @@ -8248,9 +8170,6 @@ regerror ( return msg_size; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__regerror, regerror) -#endif /* Free dynamically allocated space used by PREG. */ @@ -8271,9 +8190,7 @@ regfree (regex_t *preg) free (preg->translate); preg->translate = NULL; } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__regfree, regfree) -#endif +libc_hidden_def(regfree) #endif /* not emacs */ diff --git a/libc/misc/regex/regexec.c b/libc/misc/regex/regexec.c index 587e6af30..17d58a602 100644 --- a/libc/misc/regex/regexec.c +++ b/libc/misc/regex/regexec.c @@ -255,28 +255,7 @@ regexec (preg, string, nmatch, pmatch, eflags) __libc_lock_unlock (dfa->lock); return err != REG_NOERROR; } - -#ifdef _LIBC -# include <shlib-compat.h> -versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4); - -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) -__typeof__ (__regexec) __compat_regexec; - -int -attribute_compat_text_section -__compat_regexec (const regex_t *__restrict preg, - const char *__restrict string, size_t nmatch, - regmatch_t pmatch[], int eflags) -{ - return regexec (preg, string, nmatch, pmatch, - eflags & (REG_NOTBOL | REG_NOTEOL)); -} -compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0); -# endif -#elif defined __UCLIBC__ -strong_alias(__regexec,regexec) -#endif +libc_hidden_def(regexec) /* Entry points for GNU code. */ @@ -316,9 +295,6 @@ re_match (bufp, string, length, start, regs) { return re_search_stub (bufp, string, length, start, 0, length, regs, 1); } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_match, re_match) -#endif int re_search (bufp, string, length, start, range, regs) @@ -329,9 +305,6 @@ re_search (bufp, string, length, start, range, regs) { return re_search_stub (bufp, string, length, start, range, length, regs, 0); } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_search, re_search) -#endif int re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop) @@ -343,9 +316,6 @@ re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop) return re_search_2_stub (bufp, string1, length1, string2, length2, start, 0, regs, stop, 1); } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_match_2, re_match_2) -#endif int re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop) @@ -357,9 +327,6 @@ re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop) return re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, stop, 0); } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_search_2, re_search_2) -#endif static int re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, @@ -385,12 +352,8 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, if (BE (s == NULL, 0)) return -2; -#if (defined _LIBC || defined __UCLIBC__) && defined __USE_GNU - memcpy (__mempcpy (s, string1, length1), string2, length2); -#else memcpy (s, string1, length1); memcpy (s + length1, string2, length2); -#endif str = s; free_str = 1; } @@ -592,9 +555,6 @@ re_set_registers (bufp, regs, num_regs, starts, ends) regs->start = regs->end = (regoff_t *) 0; } } -#if defined _LIBC || defined __UCLIBC__ -strong_alias(__re_set_registers, re_set_registers) -#endif /* Entry points compatible with 4.2 BSD regex library. We don't define them unless specifically requested. */ |