*** empty log message ***

This commit is contained in:
hyung-hwan 2006-08-31 15:11:17 +00:00
parent ca64ce70f4
commit 43e2f30969
2 changed files with 21 additions and 15 deletions

View File

@ -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 <xp/awk/awk_i.h> #include <xp/awk/awk_i.h>
@ -64,20 +64,25 @@ xp_awk_tab_t* xp_awk_tab_setcapa (xp_awk_tab_t* tab, xp_size_t capa)
if (capa > 0) if (capa > 0)
{ {
#ifndef XP_AWK_NTDDK if (tab->awk->syscas->realloc != XP_NULL)
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)
{ {
xp_size_t x; tmp = XP_AWK_REALLOC (tab->awk,
x = (capa > tab->capa)? tab->capa: capa; tab->buf, xp_sizeof(*tab->buf) * capa);
xp_memcpy (tmp, tab->buf, xp_sizeof(*tab->buf) * x); if (tmp == XP_NULL) return XP_NULL;
XP_AWK_FREE (tab->awk, tab->buf); }
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 else
{ {

View File

@ -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_ #ifndef _XP_AWK_TAB_H_
@ -23,6 +23,7 @@ struct xp_awk_tab_t
}* buf; }* buf;
xp_size_t size; xp_size_t size;
xp_size_t capa; xp_size_t capa;
xp_awk_t* awk;
xp_bool_t __dynamic; xp_bool_t __dynamic;
}; };
@ -30,7 +31,7 @@ struct xp_awk_tab_t
extern "C" { extern "C" {
#endif #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); void xp_awk_tab_close (xp_awk_tab_t* tab);
xp_size_t xp_awk_tab_getsize (xp_awk_tab_t* tab); xp_size_t xp_awk_tab_getsize (xp_awk_tab_t* tab);