summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-10-28 07:15:32 +0000
committerJim Meyering <jim@meyering.net>2000-10-28 07:15:32 +0000
commitf0da6c980d6cf2c401bc7d9695011e18ee8778ba (patch)
tree3c4520d6c5391aff84930d8664846f5d85518453 /lib
parent6673e992d4e923ca8afe21d94585ae8d54d27ab4 (diff)
downloadcoreutils-f0da6c980d6cf2c401bc7d9695011e18ee8778ba.tar.xz
Update from libc.
Diffstat (limited to 'lib')
-rw-r--r--lib/regex.c9
-rw-r--r--lib/regex.h26
2 files changed, 30 insertions, 5 deletions
diff --git a/lib/regex.c b/lib/regex.c
index 35d778db9..25a219e26 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -89,6 +89,10 @@
/* This is for other GNU distributions with internationalized messages. */
#if HAVE_LIBINTL_H || defined _LIBC
# include <libintl.h>
+# ifdef _LIBC
+# undef gettext
+# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
+# endif
#else
# define gettext(msgid) (msgid)
#endif
@@ -2724,7 +2728,10 @@ regex_compile (pattern, size, syntax, bufp)
if (c1 == 1)
range_start = extra[idx];
while (c1-- > 0)
- SET_LIST_BIT (extra[idx++]);
+ {
+ SET_LIST_BIT (extra[idx]);
+ ++idx;
+ }
}
#endif
had_char_class = false;
diff --git a/lib/regex.h b/lib/regex.h
index 5edeff355..47f4af7b5 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -513,13 +513,31 @@ extern int re_exec _RE_ARGS ((const char *));
# endif
#endif
+/* GCC 2.95 and later have "__restrict"; C99 compilers have
+ "restrict", and "configure" may have defined "restrict". */
+#ifndef __restrict
+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
+# if defined restrict || 199901L <= __STDC_VERSION__
+# define __restrict restrict
+# else
+# define __restrict
+# endif
+# endif
+/* For now unconditionally define __restrict_arr to expand to nothing.
+ Ideally we would have a test for the compiler which allows defining
+ it to restrict. */
+# define __restrict_arr
+#endif
+
/* POSIX compatibility. */
-extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
+extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
+ const char *__restrict __pattern,
int __cflags));
-extern int regexec _RE_ARGS ((const regex_t *__preg,
- const char *__string, size_t __nmatch,
- regmatch_t __pmatch[], int __eflags));
+extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
+ const char *__restrict __string, size_t __nmatch,
+ regmatch_t __pmatch[__restrict_arr],
+ int __eflags));
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
char *__errbuf, size_t __errbuf_size));