fixed an initialization bug in mod-math.c

This commit is contained in:
hyung-hwan 2020-04-12 19:05:15 +00:00
parent e4de922f7d
commit 6664621a45
2 changed files with 2 additions and 2 deletions

View File

@ -713,7 +713,7 @@ int hawk_mod_math (hawk_mod_t* mod, hawk_t* awk)
hawk_get_time (&tv);
modctx->seed = tv.sec + tv.nsec;
#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);
#elif defined(HAVE_RANDOM)
srandom (modctx->seed);

View File

@ -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;
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);
return HAWK_NULL;