diff --git a/ase/awk/tab.c b/ase/awk/tab.c index 8bd593fc..98d11bc0 100644 --- a/ase/awk/tab.c +++ b/ase/awk/tab.c @@ -1,5 +1,5 @@ /* - * $Id: tab.c,v 1.12 2006-08-31 15:09:24 bacon Exp $ + * $Id: tab.c,v 1.13 2006-08-31 15:11:17 bacon Exp $ */ #include @@ -64,20 +64,25 @@ xp_awk_tab_t* xp_awk_tab_setcapa (xp_awk_tab_t* tab, xp_size_t capa) if (capa > 0) { -#ifndef XP_AWK_NTDDK - tmp = xp_realloc (tab->buf, xp_sizeof(*tab->buf) * capa); - if (tmp == XP_NULL) return XP_NULL; -#else - tmp = xp_malloc (xp_sizeof(*tab->buf) * capa); - if (tmp == XP_NULL) return XP_NULL; - if (tab->buf != XP_NULL) + if (tab->awk->syscas->realloc != XP_NULL) { - xp_size_t x; - x = (capa > tab->capa)? tab->capa: capa; - xp_memcpy (tmp, tab->buf, xp_sizeof(*tab->buf) * x); - XP_AWK_FREE (tab->awk, tab->buf); + tmp = XP_AWK_REALLOC (tab->awk, + tab->buf, xp_sizeof(*tab->buf) * capa); + if (tmp == XP_NULL) return XP_NULL; + } + else + { + tmp = XP_AWK_MALLOC ( + tab->awk, xp_sizeof(*tab->buf) * capa); + if (tmp == XP_NULL) return XP_NULL; + if (tab->buf != XP_NULL) + { + xp_size_t x; + x = (capa > tab->capa)? tab->capa: capa; + xp_memcpy (tmp, tab->buf, xp_sizeof(*tab->buf) * x); + XP_AWK_FREE (tab->awk, tab->buf); + } } -#endif } else { diff --git a/ase/awk/tab.h b/ase/awk/tab.h index fc7c516e..2faeee12 100644 --- a/ase/awk/tab.h +++ b/ase/awk/tab.h @@ -1,5 +1,5 @@ /* - * $Id: tab.h,v 1.11 2006-08-06 15:02:55 bacon Exp $ + * $Id: tab.h,v 1.12 2006-08-31 15:09:24 bacon Exp $ */ #ifndef _XP_AWK_TAB_H_ @@ -23,6 +23,7 @@ struct xp_awk_tab_t }* buf; xp_size_t size; xp_size_t capa; + xp_awk_t* awk; xp_bool_t __dynamic; }; @@ -30,7 +31,7 @@ struct xp_awk_tab_t extern "C" { #endif -xp_awk_tab_t* xp_awk_tab_open (xp_awk_tab_t* tab); +xp_awk_tab_t* xp_awk_tab_open (xp_awk_tab_t* tab, xp_awk_t* awk); void xp_awk_tab_close (xp_awk_tab_t* tab); xp_size_t xp_awk_tab_getsize (xp_awk_tab_t* tab);