summaryrefslogtreecommitdiffstats
path: root/libc/misc/regex
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/regex')
-rw-r--r--libc/misc/regex/Makefile.in3
-rw-r--r--libc/misc/regex/regcomp.c4
-rw-r--r--libc/misc/regex/regex.c13
-rw-r--r--libc/misc/regex/regex_internal.c6
-rw-r--r--libc/misc/regex/regex_internal.h3
-rw-r--r--libc/misc/regex/regex_old.c10
-rw-r--r--libc/misc/regex/regexec.c4
7 files changed, 29 insertions, 14 deletions
diff --git a/libc/misc/regex/Makefile.in b/libc/misc/regex/Makefile.in
index 4e76dee36..c6f2aea8b 100644
--- a/libc/misc/regex/Makefile.in
+++ b/libc/misc/regex/Makefile.in
@@ -1,6 +1,5 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
@@ -19,6 +18,8 @@ MISC_REGEX_SRC := $(patsubst %.c,$(MISC_REGEX_DIR)/%.c,$(CSRC))
MISC_REGEX_OBJ := $(patsubst %.c,$(MISC_REGEX_OUT)/%.o,$(CSRC))
libc-$(UCLIBC_HAS_REGEX) += $(MISC_REGEX_OBJ)
+libc-a-$(UCLIBC_HAS_REGEX) += $(MISC_REGEX_OBJ)
+libc-so-$(UCLIBC_HAS_REGEX) += $(MISC_REGEX_OBJ:.o=.os)
objclean-y += misc_regex_objclean
diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c
index 8d464db2d..471ea55f0 100644
--- a/libc/misc/regex/regcomp.c
+++ b/libc/misc/regex/regcomp.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -532,7 +532,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
{
if (BE (msg_size > errbuf_size, 0))
{
-#if defined HAVE_MEMPCPY || defined _LIBC
+#if (defined HAVE_MEMPCPY || defined _LIBC) && defined __USE_GNU
*((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
#else
memcpy (errbuf, msg, errbuf_size - 1);
diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c
index 77c09a011..192034b4e 100644
--- a/libc/misc/regex/regex.c
+++ b/libc/misc/regex/regex.c
@@ -28,12 +28,15 @@
#ifdef __UCLIBC__
#undef _LIBC
#define _REGEX_RE_COMP
-#define HAVE_MEMPCPY
+#ifdef __USE_GNU
+# define HAVE_MEMPCPY
+#endif
#define HAVE_LANGINFO
#define HAVE_LANGINFO_CODESET
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
+#include <strings.h>
#include <stdlib.h>
#ifdef __UCLIBC_HAS_WCHAR__
#define RE_ENABLE_I18N
@@ -67,9 +70,11 @@ libc_hidden_proto(wctype)
#ifdef __UCLIBC_HAS_XLOCALE__
libc_hidden_proto(__ctype_b_loc)
libc_hidden_proto(__ctype_toupper_loc)
-#else
+#elif __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)
@@ -83,8 +88,10 @@ libc_hidden_proto(strlen)
libc_hidden_proto(strncpy)
libc_hidden_proto(getenv)
libc_hidden_proto(strcasecmp)
-libc_hidden_proto(mempcpy)
libc_hidden_proto(abort)
+#ifdef __USE_GNU
+libc_hidden_proto(mempcpy)
+#endif
#endif
diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c
index 3fc62d731..fa0b336e8 100644
--- a/libc/misc/regex/regex_internal.c
+++ b/libc/misc/regex/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -259,7 +259,7 @@ build_wcs_buffer (re_string_t *pstr)
/* Build wide character buffer PSTR->WCS like build_wcs_buffer,
but for REG_ICASE. */
-static int
+static reg_errcode_t
internal_function
build_wcs_upper_buffer (re_string_t *pstr)
{
@@ -721,7 +721,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
{
if (pstr->icase)
{
- int ret = build_wcs_upper_buffer (pstr);
+ reg_errcode_t ret = build_wcs_upper_buffer (pstr);
if (BE (ret != REG_NOERROR, 0))
return ret;
}
diff --git a/libc/misc/regex/regex_internal.h b/libc/misc/regex/regex_internal.h
index d82cf6d42..a0dd28247 100644
--- a/libc/misc/regex/regex_internal.h
+++ b/libc/misc/regex/regex_internal.h
@@ -43,6 +43,9 @@ libc_hidden_proto(nl_langinfo)
#if defined HAVE_STDBOOL_H || defined _LIBC
# include <stdbool.h>
#endif /* HAVE_STDBOOL_H || _LIBC */
+#if defined HAVE_STDINT_H || defined _LIBC
+# include <stdint.h>
+#endif /* HAVE_STDINT_H || _LIBC */
#if defined _LIBC
# include <bits/libc-lock.h>
#else
diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c
index 29640734d..cf5843ec5 100644
--- a/libc/misc/regex/regex_old.c
+++ b/libc/misc/regex/regex_old.c
@@ -26,7 +26,9 @@
#ifdef __UCLIBC__
# undef _LIBC
# define _REGEX_RE_COMP
-# define HAVE_MEMPCPY
+# ifdef __USE_GNU
+# define HAVE_MEMPCPY
+# endif
# define STDC_HEADERS
# define RE_TRANSLATE_TYPE char *
#endif
@@ -41,8 +43,10 @@ libc_hidden_proto(memcpy)
libc_hidden_proto(strcmp)
libc_hidden_proto(strlen)
libc_hidden_proto(printf)
-libc_hidden_proto(mempcpy)
libc_hidden_proto(abort)
+#ifdef __USE_GNU
+libc_hidden_proto(mempcpy)
+#endif
/* AIX requires this to be the first thing in the file. */
#if defined _AIX && !defined REGEX_MALLOC
@@ -8281,7 +8285,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
{
if (msg_size > errbuf_size)
{
-#if defined HAVE_MEMPCPY || defined _LIBC
+#if (defined HAVE_MEMPCPY || defined _LIBC) && defined __USE_GNU
*((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
#else
memcpy (errbuf, msg, errbuf_size - 1);
diff --git a/libc/misc/regex/regexec.c b/libc/misc/regex/regexec.c
index c56fb9d4a..2c8917e19 100644
--- a/libc/misc/regex/regexec.c
+++ b/libc/misc/regex/regexec.c
@@ -274,7 +274,7 @@ __compat_regexec (const regex_t *__restrict preg,
}
compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
# endif
-#elif __UCLIBC__
+#elif defined __UCLIBC__
strong_alias(__regexec,regexec)
#endif
@@ -385,7 +385,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
if (BE (s == NULL, 0))
return -2;
-#if defined _LIBC || defined __UCLIBC__
+#if (defined _LIBC || defined __UCLIBC__) && defined __USE_GNU
memcpy (__mempcpy (s, string1, length1), string2, length2);
#else
memcpy (s, string1, length1);