*** empty log message ***

This commit is contained in:
hyung-hwan 2006-11-19 10:12:07 +00:00
parent 79be232fdc
commit 9b0aa1f3e9
3 changed files with 26 additions and 8 deletions

View File

@ -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_ #ifndef _ASE_AWK_AWK_H_
@ -295,8 +295,6 @@ enum
ASE_AWK_EIOHANDLER, /* io handler has returned an error */ ASE_AWK_EIOHANDLER, /* io handler has returned an error */
ASE_AWK_EFMTARG, /* arguments to format string not sufficient */ ASE_AWK_EFMTARG, /* arguments to format string not sufficient */
ASE_AWK_EFMTCONV, /* recursion detected in format conversion */ 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_ECONVFMTCHAR, /* an invalid character found in CONVFMT */
ASE_AWK_EOFMTCHAR, /* an invalid character found in OFMT */ ASE_AWK_EOFMTCHAR, /* an invalid character found in OFMT */

View File

@ -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 <ase/awk/awk_i.h> #include <ase/awk/awk_i.h>
@ -105,8 +105,6 @@ const ase_char_t* ase_awk_geterrstr (int errnum)
ASE_T("io handler has returned an error"), ASE_T("io handler has returned an error"),
ASE_T("not sufficient arguments to formatting sequence"), ASE_T("not sufficient arguments to formatting sequence"),
ASE_T("recursion detected in format conversion"), 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 CONVFMT"),
ASE_T("invalid character in OFMT"), ASE_T("invalid character in OFMT"),

View File

@ -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 <ase/awk/awk_i.h> #include <ase/awk/awk_i.h>
@ -706,12 +706,27 @@ static int __init_run (ase_awk_run_t* run, ase_awk_runios_t* runios, int* errnum
return -1; 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) if (run->awk->tree.chain_size > 0)
{ {
run->pattern_range_state = (ase_byte_t*) ASE_AWK_MALLOC ( run->pattern_range_state = (ase_byte_t*) ASE_AWK_MALLOC (
run->awk, run->awk->tree.chain_size*ase_sizeof(ase_byte_t)); run->awk, run->awk->tree.chain_size*ase_sizeof(ase_byte_t));
if (run->pattern_range_state == ASE_NULL) if (run->pattern_range_state == ASE_NULL)
{ {
ASE_AWK_FREE (run->awk, run->format.tmp.ptr);
ase_awk_map_close (&run->named); ase_awk_map_close (&run->named);
ase_awk_str_close (&run->format.fmt); ase_awk_str_close (&run->format.fmt);
ase_awk_str_close (&run->format.out); 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; 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.fmt);
ase_awk_str_close (&run->format.out); ase_awk_str_close (&run->format.out);
@ -5573,10 +5591,14 @@ ase_char_t* ase_awk_format (
(buf)->ptr = ASE_NULL; \ (buf)->ptr = ASE_NULL; \
} \ } \
(buf)->len += (buf)->inc; \ (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; \ if ((buf)->ptr == ASE_NULL) (buf)->len = 0; \
} while (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) if (nargs_on_stack == (ase_size_t)-1)
{ {
val = (ase_awk_val_t*)args; val = (ase_awk_val_t*)args;