fixed an initialization bug in mod-math.c
This commit is contained in:
parent
e4de922f7d
commit
6664621a45
@ -713,7 +713,7 @@ int hawk_mod_math (hawk_mod_t* mod, hawk_t* awk)
|
|||||||
hawk_get_time (&tv);
|
hawk_get_time (&tv);
|
||||||
modctx->seed = tv.sec + tv.nsec;
|
modctx->seed = tv.sec + tv.nsec;
|
||||||
#if defined(HAVE_INITSTATE_R) && defined(HAVE_SRANDOM_R) && defined(HAVE_RANDOM_R)
|
#if defined(HAVE_INITSTATE_R) && defined(HAVE_SRANDOM_R) && defined(HAVE_RANDOM_R)
|
||||||
initstate_r (0, &modctx->prand_bin, HAWK_SIZEOF(&modctx->prand_bin), &modctx->prand);
|
initstate_r (0, modctx->prand_bin, HAWK_SIZEOF(modctx->prand_bin), &modctx->prand);
|
||||||
srandom_r (modctx->seed, &modctx->prand);
|
srandom_r (modctx->seed, &modctx->prand);
|
||||||
#elif defined(HAVE_RANDOM)
|
#elif defined(HAVE_RANDOM)
|
||||||
srandom (modctx->seed);
|
srandom (modctx->seed);
|
||||||
|
@ -7327,7 +7327,7 @@ static hawk_mod_t* query_module (hawk_t* awk, const hawk_oocs_t segs[], int nseg
|
|||||||
if (pair == HAWK_NULL) return HAWK_NULL;
|
if (pair == HAWK_NULL) return HAWK_NULL;
|
||||||
|
|
||||||
mdp = (hawk_mod_data_t*)HAWK_RBT_VPTR(pair);
|
mdp = (hawk_mod_data_t*)HAWK_RBT_VPTR(pair);
|
||||||
if (load (&mdp->mod, awk) <= -1)
|
if (load(&mdp->mod, awk) <= -1)
|
||||||
{
|
{
|
||||||
hawk_rbt_delete (awk->modtab, segs[0].ptr, segs[0].len);
|
hawk_rbt_delete (awk->modtab, segs[0].ptr, segs[0].len);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user