From 9b0aa1f3e9c09de1e847acd4ba3f555824d9e712 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 19 Nov 2006 10:12:07 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/awk.h | 4 +--- ase/awk/err.c | 4 +--- ase/awk/run.c | 26 ++++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ase/awk/awk.h b/ase/awk/awk.h index 06acf870..80185833 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.144 2006-11-19 10:03:18 bacon Exp $ + * $Id: awk.h,v 1.145 2006-11-19 10:12:07 bacon Exp $ */ #ifndef _ASE_AWK_AWK_H_ @@ -295,8 +295,6 @@ enum ASE_AWK_EIOHANDLER, /* io handler has returned an error */ ASE_AWK_EFMTARG, /* arguments to format string not sufficient */ ASE_AWK_EFMTCONV, /* recursion detected in format conversion */ - ASE_AWK_EFMTWIDTH, /* invalid format specifier width */ - ASE_AWK_EFMTPREC, /* invalid format specifier precision */ ASE_AWK_ECONVFMTCHAR, /* an invalid character found in CONVFMT */ ASE_AWK_EOFMTCHAR, /* an invalid character found in OFMT */ diff --git a/ase/awk/err.c b/ase/awk/err.c index ba46b521..74151aac 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,5 +1,5 @@ /* - * $Id: err.c,v 1.50 2006-11-19 10:03:18 bacon Exp $ + * $Id: err.c,v 1.51 2006-11-19 10:12:07 bacon Exp $ */ #include @@ -105,8 +105,6 @@ const ase_char_t* ase_awk_geterrstr (int errnum) ASE_T("io handler has returned an error"), ASE_T("not sufficient arguments to formatting sequence"), ASE_T("recursion detected in format conversion"), - ASE_T("invalid format specifier width"), - ASE_T("invalid format specifier precision"), ASE_T("invalid character in CONVFMT"), ASE_T("invalid character in OFMT"), diff --git a/ase/awk/run.c b/ase/awk/run.c index 49fd88ba..01ad6996 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.269 2006-11-19 10:05:42 bacon Exp $ + * $Id: run.c,v 1.270 2006-11-19 10:12:07 bacon Exp $ */ #include @@ -706,12 +706,27 @@ static int __init_run (ase_awk_run_t* run, ase_awk_runios_t* runios, int* errnum return -1; } + run->format.tmp.ptr = (ase_char_t*) + ASE_AWK_MALLOC (run->awk, 4096*ase_sizeof(ase_char_t*)); + if (run->format.tmp.ptr == ASE_NULL) + { + ase_awk_map_close (&run->named); + ase_awk_str_close (&run->format.fmt); + ase_awk_str_close (&run->format.out); + ase_awk_str_close (&run->inrec.line); + *errnum = ASE_AWK_ENOMEM; + return -1; + } + run->format.tmp.len = 4096; + run->format.tmp.ptr = 4096; + if (run->awk->tree.chain_size > 0) { run->pattern_range_state = (ase_byte_t*) ASE_AWK_MALLOC ( run->awk, run->awk->tree.chain_size*ase_sizeof(ase_byte_t)); if (run->pattern_range_state == ASE_NULL) { + ASE_AWK_FREE (run->awk, run->format.tmp.ptr); ase_awk_map_close (&run->named); ase_awk_str_close (&run->format.fmt); ase_awk_str_close (&run->format.out); @@ -801,6 +816,9 @@ static void __deinit_run (ase_awk_run_t* run) run->global.subsep.len = 0; } + ASE_AWK_FREE (run->awk, run->format.tmp.ptr); + run->format.tmp.ptr = ASE_NULL; + run->format.tmp.len = 0; ase_awk_str_close (&run->format.fmt); ase_awk_str_close (&run->format.out); @@ -5573,10 +5591,14 @@ ase_char_t* ase_awk_format ( (buf)->ptr = ASE_NULL; \ } \ (buf)->len += (buf)->inc; \ - (buf)->ptr = ASE_AWK_MALLOC (run->awk, (buf)->len); \ + (buf)->ptr = (ase_char_t*)ASE_AWK_MALLOC ( \ + run->awk, (buf)->len * ase_sizeof(ase_char_t)); \ if ((buf)->ptr == ASE_NULL) (buf)->len = 0; \ } while (0) + ASE_AWK_ASSERTX (run->awk, run->format.tmp.ptr != ASE_NULL, + "run->format.tmp.ptr should have been assigned a pointer to a block of memory before this function has been called"); + if (nargs_on_stack == (ase_size_t)-1) { val = (ase_awk_val_t*)args;