summaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-07-18 04:41:16 +0000
committerRoland McGrath <roland@gnu.org>2005-07-18 04:41:16 +0000
commit7a85da437bd49afd827c41474677c3904cf7ce3e (patch)
tree8ab56107960fcc0f3a2cf39f2eef07aadc180e1a /stdlib
parentefe36102b1d423e82e94217e069460134cde5687 (diff)
Updated to fedora-glibc-2_3-20050718T0425
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/random_r.c29
-rw-r--r--stdlib/stdlib.h2
2 files changed, 14 insertions, 17 deletions
diff --git a/stdlib/random_r.c b/stdlib/random_r.c
index e955ea576a..404006f2cd 100644
--- a/stdlib/random_r.c
+++ b/stdlib/random_r.c
@@ -236,23 +236,20 @@ __initstate_r (seed, arg_state, n, buf)
size_t n;
struct random_data *buf;
{
- int type;
- int degree;
- int separation;
- int32_t *state;
- int old_type;
- int32_t *old_state;
-
if (buf == NULL)
goto fail;
- old_type = buf->rand_type;
- old_state = buf->state;
- if (old_type == TYPE_0)
- old_state[-1] = TYPE_0;
- else
- old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+ int32_t *old_state = buf->state;
+ if (old_state != NULL)
+ {
+ int old_type = buf->rand_type;
+ if (old_type == TYPE_0)
+ old_state[-1] = TYPE_0;
+ else
+ old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+ }
+ int type;
if (n >= BREAK_3)
type = n < BREAK_4 ? TYPE_3 : TYPE_4;
else if (n < BREAK_1)
@@ -267,13 +264,13 @@ __initstate_r (seed, arg_state, n, buf)
else
type = n < BREAK_2 ? TYPE_1 : TYPE_2;
- degree = random_poly_info.degrees[type];
- separation = random_poly_info.seps[type];
+ int degree = random_poly_info.degrees[type];
+ int separation = random_poly_info.seps[type];
buf->rand_type = type;
buf->rand_sep = separation;
buf->rand_deg = degree;
- state = &((int32_t *) arg_state)[1]; /* First location. */
+ int32_t *state = &((int32_t *) arg_state)[1]; /* First location. */
/* Must set END_PTR before srandom. */
buf->end_ptr = &state[degree];
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 1bda32262b..cb19fcb03d 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -614,7 +614,7 @@ extern void *valloc (size_t __size) __THROW __attribute_malloc__;
#ifdef __USE_XOPEN2K
/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
- __THROW __attribute_malloc__ __nonnull ((1));
+ __THROW __nonnull ((1));
#endif
__BEGIN_NAMESPACE_STD