added a few lines of code to print simple memory allocation counts in cmd/awk/awk.c and cmd/sed/sed.c.

got rid of redundant realloc handler check in lib/awk/*.c
This commit is contained in:
2011-12-21 06:40:27 +00:00
parent 42c44f9d3d
commit 38d3c22d1f
4 changed files with 69 additions and 49 deletions

View File

@ -6385,25 +6385,10 @@ static int __raw_push (qse_awk_rtx_t* run, void* val)
n = run->stack_limit + STACK_INCREMENT;
if (MMGR(run)->realloc != QSE_NULL)
{
tmp = (void**) QSE_AWK_REALLOC (
run->awk, run->stack, n * QSE_SIZEOF(void*));
if (tmp == QSE_NULL) return -1;
}
else
{
tmp = (void**) QSE_AWK_ALLOC (
run->awk, n * QSE_SIZEOF(void*));
if (tmp == QSE_NULL) return -1;
if (run->stack != QSE_NULL)
{
QSE_MEMCPY (
tmp, run->stack,
run->stack_limit * QSE_SIZEOF(void*));
QSE_AWK_FREE (run->awk, run->stack);
}
}
tmp = (void**) QSE_AWK_REALLOC (
run->awk, run->stack, n * QSE_SIZEOF(void*));
if (tmp == QSE_NULL) return -1;
run->stack = tmp;
run->stack_limit = n;
}