*** empty log message ***

This commit is contained in:
hyung-hwan 2006-08-21 02:53:42 +00:00
parent e590e6130a
commit bb7a22e049
3 changed files with 29 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk_i.h,v 1.45 2006-08-16 09:35:21 bacon Exp $ * $Id: awk_i.h,v 1.46 2006-08-21 02:53:42 bacon Exp $
*/ */
#ifndef _XP_AWK_AWKI_H_ #ifndef _XP_AWK_AWKI_H_
@ -156,8 +156,10 @@ struct xp_awk_run_t
xp_awk_val_int_t* icache[100]; /* TODO: choose the optimal size */ xp_awk_val_int_t* icache[100]; /* TODO: choose the optimal size */
xp_awk_val_real_t* rcache[100]; /* TODO: choose the optimal size */ xp_awk_val_real_t* rcache[100]; /* TODO: choose the optimal size */
xp_awk_val_ref_t* fcache[100]; /* TODO: choose the optimal size */
xp_size_t icache_count; xp_size_t icache_count;
xp_size_t rcache_count; xp_size_t rcache_count;
xp_size_t fcache_count;
xp_awk_nde_blk_t* active_block; xp_awk_nde_blk_t* active_block;
xp_byte_t* pattern_range_state; xp_byte_t* pattern_range_state;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: run.c,v 1.172 2006-08-20 15:49:06 bacon Exp $ * $Id: run.c,v 1.173 2006-08-21 02:53:42 bacon Exp $
*/ */
#include <xp/awk/awk_i.h> #include <xp/awk/awk_i.h>
@ -425,6 +425,7 @@ static int __init_run (
run->icache_count = 0; run->icache_count = 0;
run->rcache_count = 0; run->rcache_count = 0;
run->fcache_count = 0;
run->errnum = XP_AWK_ENOERR; run->errnum = XP_AWK_ENOERR;
@ -515,6 +516,12 @@ static void __deinit_run (xp_awk_run_t* run)
xp_awk_val_real_t* tmp = run->rcache[--run->rcache_count]; xp_awk_val_real_t* tmp = run->rcache[--run->rcache_count];
xp_awk_freeval (run, (xp_awk_val_t*)tmp, xp_false); xp_awk_freeval (run, (xp_awk_val_t*)tmp, xp_false);
} }
while (run->fcache_count > 0)
{
xp_awk_val_ref_t* tmp = run->fcache[--run->fcache_count];
xp_awk_freeval (run, (xp_awk_val_t*)tmp, xp_false);
}
} }
static int __run_main (xp_awk_run_t* run) static int __run_main (xp_awk_run_t* run)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: val.c,v 1.51 2006-08-20 15:49:07 bacon Exp $ * $Id: val.c,v 1.52 2006-08-21 02:53:42 bacon Exp $
*/ */
#include <xp/awk/awk_i.h> #include <xp/awk/awk_i.h>
@ -198,8 +198,16 @@ xp_awk_val_t* xp_awk_makerefval (xp_awk_run_t* run, int id, xp_awk_val_t** adr)
{ {
xp_awk_val_ref_t* val; xp_awk_val_ref_t* val;
val = (xp_awk_val_ref_t*) xp_malloc (xp_sizeof(xp_awk_val_ref_t)); if (run->fcache_count > 0)
if (val == XP_NULL) return XP_NULL; {
val = run->fcache[--run->fcache_count];
}
else
{
val = (xp_awk_val_ref_t*)
xp_malloc (xp_sizeof(xp_awk_val_ref_t));
if (val == XP_NULL) return XP_NULL;
}
val->type = XP_AWK_VAL_REF; val->type = XP_AWK_VAL_REF;
val->ref = 0; val->ref = 0;
@ -267,7 +275,13 @@ xp_printf (XP_T("\n"));*/
} }
else if (val->type == XP_AWK_VAL_REF) else if (val->type == XP_AWK_VAL_REF)
{ {
xp_free (val); if (cache == xp_true &&
run->fcache_count < xp_countof(run->fcache))
{
run->fcache[run->fcache_count++] =
(xp_awk_val_ref_t*)val;
}
else xp_free (val);
} }
else else
{ {