aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-21 23:31:38 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-21 23:31:38 +0000
commit7ca404adab483820ed7d43e961fef91d2e978f90 (patch)
treeded80da1a4c787630f73d6668daeec69f2fbca04
parent63336471f0e705e7259c9ecb0f9b473890ff5ffc (diff)
downloadglibc-7ca404adab483820ed7d43e961fef91d2e978f90.tar
glibc-7ca404adab483820ed7d43e961fef91d2e978f90.tar.gz
glibc-7ca404adab483820ed7d43e961fef91d2e978f90.tar.bz2
glibc-7ca404adab483820ed7d43e961fef91d2e978f90.zip
Update.
* stdlib/random_r.c (__setstate_r): Correct offset when computing new rptr and fptr. Reported by Michael Fischer <fischer@cs.yale.edu>. * posix/regex.h: Add macro definitions to allow compiling outside glibc.
-rw-r--r--ChangeLog6
-rw-r--r--posix/regex.h16
-rw-r--r--stdlib/random_r.c4
3 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d693fdf26..bcbcaa0d31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2000-08-21 Ulrich Drepper <drepper@redhat.com>
+ * stdlib/random_r.c (__setstate_r): Correct offset when computing
+ new rptr and fptr. Reported by Michael Fischer <fischer@cs.yale.edu>.
+
+ * posix/regex.h: Add macro definitions to allow compiling outside
+ glibc.
+
* sysdeps/i370/Implies: Removed.
* sysdeps/mvs/Implies: Removed.
diff --git a/posix/regex.h b/posix/regex.h
index 8576fe68fa..47f4af7b55 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -513,6 +513,22 @@ 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 *__restrict __preg,
const char *__restrict __pattern,
diff --git a/stdlib/random_r.c b/stdlib/random_r.c
index 27573b3b05..1d9e56f19b 100644
--- a/stdlib/random_r.c
+++ b/stdlib/random_r.c
@@ -295,8 +295,8 @@ __setstate_r (arg_state, buf)
if (type != TYPE_0)
{
int rear = new_state[0] / MAX_TYPES;
- buf->rptr = &new_state[rear];
- buf->fptr = &new_state[(rear + separation) % degree];
+ buf->rptr = &new_state[1 + rear];
+ buf->fptr = &new_state[1 + (rear + separation) % degree];
}
buf->state = &new_state[1];
/* Set end_ptr too. */