optimise the non-arc4random case while not touching the default case
This commit is contained in:
parent
94ee3b388a
commit
a09f40cacd
10
var.c
10
var.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.13 2006/01/29 20:04:54 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.14 2006/01/29 20:10:16 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables
|
* Variables
|
||||||
@ -848,7 +848,9 @@ makenv(void)
|
|||||||
* Someone has set the srand() value, therefore from now on
|
* Someone has set the srand() value, therefore from now on
|
||||||
* we return values from rand() instead of arc4random()
|
* we return values from rand() instead of arc4random()
|
||||||
*/
|
*/
|
||||||
int use_rand = !HAVE_ARC4RANDOM;
|
#if HAVE_ARC4RANDOM
|
||||||
|
int use_rand = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called after a fork in parent to bump the random number generator.
|
* Called after a fork in parent to bump the random number generator.
|
||||||
@ -858,7 +860,9 @@ int use_rand = !HAVE_ARC4RANDOM;
|
|||||||
void
|
void
|
||||||
change_random(void)
|
change_random(void)
|
||||||
{
|
{
|
||||||
|
#if HAVE_ARC4RANDOM
|
||||||
if (use_rand)
|
if (use_rand)
|
||||||
|
#endif
|
||||||
rand();
|
rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,7 +910,9 @@ getspec(struct tbl *vp)
|
|||||||
break;
|
break;
|
||||||
case V_RANDOM:
|
case V_RANDOM:
|
||||||
vp->flag &= ~SPECIAL;
|
vp->flag &= ~SPECIAL;
|
||||||
|
#if HAVE_ARC4RANDOM
|
||||||
if (use_rand)
|
if (use_rand)
|
||||||
|
#endif
|
||||||
setint(vp, (long) (rand() & 0x7fff));
|
setint(vp, (long) (rand() & 0x7fff));
|
||||||
#if HAVE_ARC4RANDOM
|
#if HAVE_ARC4RANDOM
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user