From: Ulrich Drepper Date: Thu, 10 Sep 1998 17:07:14 +0000 (+0000) Subject: (__setstate_r): Allow call with same state array as currently used. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a4fe38ed69f8173bf669083881174ce19061ad5;p=thirdparty%2Fglibc.git (__setstate_r): Allow call with same state array as currently used. --- diff --git a/stdlib/random_r.c b/stdlib/random_r.c index 6355097a936..d01f13383fe 100644 --- a/stdlib/random_r.c +++ b/stdlib/random_r.c @@ -243,8 +243,8 @@ __setstate_r (arg_state, buf) struct random_data *buf; { int32_t *new_state = (int32_t *) arg_state; - int type = new_state[0] % MAX_TYPES; - int rear = new_state[0] / MAX_TYPES; + int type; + int rear; if (buf == NULL) return -1; @@ -254,6 +254,9 @@ __setstate_r (arg_state, buf) else buf->state[-1] = (MAX_TYPES * (buf->rptr - buf->state)) + buf->rand_type; + type = new_state[0] % MAX_TYPES; + rear = new_state[0] / MAX_TYPES; + switch (type) { case TYPE_0: