summaryrefslogtreecommitdiff
path: root/libc/misc/regex
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-14 00:58:03 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-14 00:58:03 +0000
commitaf0172162f7c653cad6a11ed1c1a5459bc154465 (patch)
tree70031dad1e7286d58762da7b9e3d3f93d043c278 /libc/misc/regex
parentc8609543a9a8bf6559c2931dbbef6b3c41b3fbf2 (diff)
hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing headers, other jump relocs removed
Diffstat (limited to 'libc/misc/regex')
-rw-r--r--libc/misc/regex/regcomp.c5
-rw-r--r--libc/misc/regex/regex.c69
-rw-r--r--libc/misc/regex/regex_old.c49
3 files changed, 65 insertions, 58 deletions
diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c
index 419d879be..848097c26 100644
--- a/libc/misc/regex/regcomp.c
+++ b/libc/misc/regex/regcomp.c
@@ -835,8 +835,9 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
#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;
+# define MB_CUR_MAX (_stdlib_mb_cur_max ())
+extern size_t _stdlib_mb_cur_max (void) __THROW __wur;
+libc_hidden_proto(_stdlib_mb_cur_max)
dfa->mb_cur_max = MB_CUR_MAX;
#else
dfa->mb_cur_max = 1;
diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c
index 99de9fd6c..8bac9c775 100644
--- a/libc/misc/regex/regex.c
+++ b/libc/misc/regex/regex.c
@@ -23,6 +23,7 @@
#endif
/* uClibc addons */
+#define _GNU_SOURCE
#include <features.h>
#ifdef __UCLIBC__
@@ -30,46 +31,50 @@
#define _REGEX_RE_COMP
#include <stdbool.h>
#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
#ifdef __UCLIBC_HAS_WCHAR__
#define RE_ENABLE_I18N
-#define wcscoll __wcscoll
-#define wcrtomb __wcrtomb
-#define mbrtowc __mbrtowc
-#define iswctype __iswctype
-#define iswlower __iswlower
-#define iswalnum __iswalnum
-#define towlower __towlower
-#define towupper __towupper
-#define mbsinit __mbsinit
#include <wchar.h>
#include <wctype.h>
-/* attribute_hidden produces text relocation */
-//extern int __wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW /*attribute_hidden*/;
+#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)
-extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc,
- mbstate_t *__restrict __ps) attribute_hidden;
-
-extern wint_t __btowc (int __c) attribute_hidden;
-
-extern wctype_t __wctype (__const char *__property) attribute_hidden;
-
-//extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/;
#endif
-#define memcmp __memcmp
-#define memcpy __memcpy
-#define memmove __memmove
-#define memset __memset
-#define strchr __strchr
-#define strcmp __strcmp
-#define strlen __strlen
-#define strncpy __strncpy
-#define getenv __getenv
-#define strcasecmp __strcasecmp
-
-extern void *__mempcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n) attribute_hidden;
+#include <ctype.h>
+#define __toupper toupper
+#define __tolower tolower
+#define __mempcpy mempcpy
+libc_hidden_proto(toupper)
+libc_hidden_proto(tolower)
+libc_hidden_proto(memcmp)
+libc_hidden_proto(memcpy)
+libc_hidden_proto(memmove)
+libc_hidden_proto(memset)
+libc_hidden_proto(strchr)
+libc_hidden_proto(strcmp)
+libc_hidden_proto(strlen)
+libc_hidden_proto(strncpy)
+libc_hidden_proto(getenv)
+libc_hidden_proto(strcasecmp)
+libc_hidden_proto(mempcpy)
+libc_hidden_proto(abort)
+
#endif
/* Make sure noone compiles this code with a C++ compiler. */
diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c
index 9031cebff..b64014e98 100644
--- a/libc/misc/regex/regex_old.c
+++ b/libc/misc/regex/regex_old.c
@@ -20,37 +20,29 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define HAVE_MEMPCPY
-#define memset __memset
-#define memcmp __memcmp
-#define strcmp __strcmp
-#define strlen __strlen
-#define wcslen __wcslen
-/* for some reason this does not work */
-#define memcpy __memcpy
-#define mbrtowc __mbrtowc
-#define wcrtomb __wcrtomb
-#define wcscoll __wcscoll
-#define wctype __wctype
-#define iswctype __iswctype
-#define iswalnum __iswalnum
-#define printf __printf
-#define btowc __btowc
-
/* To exclude some unwanted junk.... */
#undef emacs
-#define _REGEX_RE_COMP
+#define _GNU_SOURCE
#include <features.h>
#ifdef __UCLIBC__
# undef _LIBC
+# define _REGEX_RE_COMP
+# define HAVE_MEMPCPY
+# define STDC_HEADERS
+# define RE_TRANSLATE_TYPE char *
#endif
#include <stdlib.h>
#include <string.h>
-#define STDC_HEADERS
-#define RE_TRANSLATE_TYPE char *
+#include <stdio.h>
-extern void *__mempcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n) /*attribute_hidden*/;
+libc_hidden_proto(memset)
+libc_hidden_proto(memcmp)
+libc_hidden_proto(memcpy)
+libc_hidden_proto(strcmp)
+libc_hidden_proto(strlen)
+libc_hidden_proto(printf)
+libc_hidden_proto(mempcpy)
+libc_hidden_proto(abort)
/* AIX requires this to be the first thing in the file. */
#if defined _AIX && !defined REGEX_MALLOC
@@ -89,6 +81,15 @@ extern void *__mempcpy (void *__restrict __dest,
/* 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__
@@ -113,10 +114,10 @@ extern void *__mempcpy (void *__restrict __dest,
__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
/* We are also using some library internals. */
-# ifndef __UCLIBC__
# include <locale/localeinfo.h>
# include <locale/elem-hash.h>
# include <langinfo.h>
@@ -8280,7 +8281,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
if (msg_size > errbuf_size)
{
#if defined HAVE_MEMPCPY || defined _LIBC
- *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
+ *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
#else
memcpy (errbuf, msg, errbuf_size - 1);
errbuf[errbuf_size - 1] = 0;