This commit is contained in:
hyung-hwan 2008-01-16 08:17:20 +00:00
parent 9da2f0772f
commit 1c04715856

View File

@ -84,34 +84,35 @@ ase_awk_val_t* ase_awk_makeintval (ase_awk_run_t* run, ase_long_t v)
} }
} }
*/ */
ase_awk_val_chunk_t* p = run->ichunk;
ase_awk_val_int_t* f = run->ifree; ase_awk_val_int_t* f = run->ifree;
if (f = ASE_NULL) if (f = ASE_NULL)
{ {
ase_awk_val_chunk_t* c;
ase_awk_val_int_t* x; ase_awk_val_int_t* x;
ase_size_t i; ase_size_t i;
p = ASE_AWK_MALLOC (run->awk, c = ASE_AWK_MALLOC (run->awk,
ASE_SIZEOF(ase_awk_val_chunk_t)+ ASE_SIZEOF(ase_awk_val_chunk_t)+
ASE_SIZEOF(ase_awk_val_int_t)*100); ASE_SIZEOF(ase_awk_val_int_t)*100);
if (p == ASE_NULL) if (c == ASE_NULL)
{ {
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM); ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL; return ASE_NULL;
} }
x = (ase_awk_val_int_t*)(p + 1); x = (ase_awk_val_int_t*)(c + 1);
for (i = 0; i < 100-1; i++) for (i = 0; i < 100-1; i++)
x[i].nde = (ase_awk_nde_int_t*)&x[i+1]; x[i].nde = (ase_awk_nde_int_t*)&x[i+1];
x[i].nde = ASE_NULL; x[i].nde = ASE_NULL;
run->ifree = &f[0]; run->ifree = &x[0];
p->next = run->ichunk; c->next = run->ichunk;
run->ichunk = c;
} }
val = run->ifree; val = run->ifree;
run->ifree = (ase_awk_val_int_t*)run->ifree->nde; run->ifree = (ase_awk_val_int_t*)val->nde;
val->type = ASE_AWK_VAL_INT; val->type = ASE_AWK_VAL_INT;
val->ref = 0; val->ref = 0;
@ -423,15 +424,10 @@ void ase_awk_freeval (ase_awk_run_t* run, ase_awk_val_t* val, ase_bool_t cache)
} }
else ASE_AWK_FREE (run->awk, val); else ASE_AWK_FREE (run->awk, val);
*/ */
if (cache)
{
((ase_awk_val_int_t*)val)->nde = ((ase_awk_val_int_t*)val)->nde = (ase_awk_nde_int_t*)run->ifree;
(ase_awk_nde_int_t*)run->ifree;
run->ifree = val; run->ifree = val;
} }
else ASE_AWK_FREE (run->awk, val);
}
else if (val->type == ASE_AWK_VAL_REAL) else if (val->type == ASE_AWK_VAL_REAL)
{ {
if (cache && run->rcache_count < ASE_COUNTOF(run->rcache)) if (cache && run->rcache_count < ASE_COUNTOF(run->rcache))