*** empty log message ***

This commit is contained in:
hyung-hwan 2005-12-05 15:11:29 +00:00
parent a9d96b387a
commit 86de8c2da3
18 changed files with 72 additions and 72 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c,v 1.3 2005-11-14 15:23:53 bacon Exp $ * $Id: awk.c,v 1.4 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/awk/awk.h> #include <xp/awk/awk.h>
@ -11,12 +11,12 @@ xp_awk_t* xp_awk_open (xp_awk_t* awk)
if (awk == XP_NULL) { if (awk == XP_NULL) {
awk = (xp_awk_t*) xp_malloc (xp_sizeof(awk)); awk = (xp_awk_t*) xp_malloc (xp_sizeof(awk));
if (awk == XP_NULL) return XP_NULL; if (awk == XP_NULL) return XP_NULL;
awk->__malloced = xp_true; awk->__dynamic = xp_true;
} }
else awk->__malloced = xp_false; else awk->__dynamic = xp_false;
if (xp_str_open(&awk->token.name, 128) == XP_NULL) { if (xp_str_open(&awk->token.name, 128) == XP_NULL) {
if (awk->__malloced) xp_free (awk); if (awk->__dynamic) xp_free (awk);
return XP_NULL; return XP_NULL;
} }
@ -40,7 +40,7 @@ int xp_awk_close (xp_awk_t* awk)
{ {
if (xp_awk_detach_source(awk) == -1) return -1; if (xp_awk_detach_source(awk) == -1) return -1;
xp_str_close (&awk->token.name); xp_str_close (&awk->token.name);
if (awk->__malloced) xp_free (awk); if (awk->__dynamic) xp_free (awk);
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.h,v 1.4 2005-11-14 15:23:53 bacon Exp $ * $Id: awk.h,v 1.5 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_AWK_AWK_H_ #ifndef _XP_AWK_AWK_H_
@ -64,7 +64,7 @@ struct xp_awk_t
/* housekeeping */ /* housekeeping */
int errnum; int errnum;
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
* $Id: mem.c,v 1.1 2005-09-30 09:40:15 bacon Exp $ * $Id: mem.c,v 1.2 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/sce/mem.h> #include <xp/sce/mem.h>
@ -15,14 +15,14 @@ xp_sce_mem_t* xp_sce_mem_open (
if (mem == XP_NULL) { if (mem == XP_NULL) {
mem = (xp_sce_mem_t*)xp_malloc(xp_sizeof(xp_sce_mem_t)); mem = (xp_sce_mem_t*)xp_malloc(xp_sizeof(xp_sce_mem_t));
if (mem == XP_NULL) return XP_NULL; if (mem == XP_NULL) return XP_NULL;
mem->__malloced = xp_true; mem->__dynamic = xp_true;
} }
else mem->__malloced = xp_false; else mem->__dynamic = xp_false;
slots = (xp_sce_obj_t**)xp_malloc ( slots = (xp_sce_obj_t**)xp_malloc (
capacity * xp_sizeof(xp_sce_obj_t*)); capacity * xp_sizeof(xp_sce_obj_t*));
if (slots == XP_NULL) { if (slots == XP_NULL) {
if (mem->__malloced) xp_free (mem); if (mem->__dynamic) xp_free (mem);
mem = XP_NULL; mem = XP_NULL;
} }
@ -47,7 +47,7 @@ void xp_sce_mem_close (xp_sce_mem_t* mem)
mem->capacity = 0; mem->capacity = 0;
mem->slots = XP_NULL; mem->slots = XP_NULL;
mem->free = XP_NULL; mem->free = XP_NULL;
if (mem->__malloced) xp_free (mem); if (mem->__dynamic) xp_free (mem);
} }
void xp_sce_mem_gc (xp_sce_mem_t* mem) void xp_sce_mem_gc (xp_sce_mem_t* mem)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: init.c,v 1.10 2005-09-21 11:52:36 bacon Exp $ * $Id: init.c,v 1.11 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/lsp/lsp.h> #include <xp/lsp/lsp.h>
@ -15,12 +15,12 @@ xp_lsp_t* xp_lsp_open (xp_lsp_t* lsp,
if (lsp == XP_NULL) { if (lsp == XP_NULL) {
lsp = (xp_lsp_t*)xp_malloc(xp_sizeof(xp_lsp_t)); lsp = (xp_lsp_t*)xp_malloc(xp_sizeof(xp_lsp_t));
if (lsp == XP_NULL) return lsp; if (lsp == XP_NULL) return lsp;
lsp->__malloced = xp_true; lsp->__dynamic = xp_true;
} }
else lsp->__malloced = xp_false; else lsp->__dynamic = xp_false;
if (xp_lsp_token_open(&lsp->token, 0) == XP_NULL) { if (xp_lsp_token_open(&lsp->token, 0) == XP_NULL) {
if (lsp->__malloced) xp_free (lsp); if (lsp->__dynamic) xp_free (lsp);
return XP_NULL; return XP_NULL;
} }
@ -37,14 +37,14 @@ xp_lsp_t* xp_lsp_open (xp_lsp_t* lsp,
lsp->mem = xp_lsp_mem_new (mem_ubound, mem_ubound_inc); lsp->mem = xp_lsp_mem_new (mem_ubound, mem_ubound_inc);
if (lsp->mem == XP_NULL) { if (lsp->mem == XP_NULL) {
xp_lsp_token_close (&lsp->token); xp_lsp_token_close (&lsp->token);
if (lsp->__malloced) xp_free (lsp); if (lsp->__dynamic) xp_free (lsp);
return XP_NULL; return XP_NULL;
} }
if (__add_builtin_prims(lsp) == -1) { if (__add_builtin_prims(lsp) == -1) {
xp_lsp_mem_free (lsp->mem); xp_lsp_mem_free (lsp->mem);
xp_lsp_token_close (&lsp->token); xp_lsp_token_close (&lsp->token);
if (lsp->__malloced) xp_free (lsp); if (lsp->__dynamic) xp_free (lsp);
return XP_NULL; return XP_NULL;
} }
@ -59,7 +59,7 @@ void xp_lsp_close (xp_lsp_t* lsp)
xp_assert (lsp != XP_NULL); xp_assert (lsp != XP_NULL);
xp_lsp_mem_free (lsp->mem); xp_lsp_mem_free (lsp->mem);
xp_lsp_token_close (&lsp->token); xp_lsp_token_close (&lsp->token);
if (lsp->__malloced) xp_free (lsp); if (lsp->__dynamic) xp_free (lsp);
} }
int xp_lsp_attach_input (xp_lsp_t* lsp, xp_lsp_io_t input, void* arg) int xp_lsp_attach_input (xp_lsp_t* lsp, xp_lsp_io_t input, void* arg)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: lsp.h,v 1.19 2005-10-19 15:44:29 bacon Exp $ * $Id: lsp.h,v 1.20 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_LSP_LSP_H_ #ifndef _XP_LSP_LSP_H_
@ -91,7 +91,7 @@ struct xp_lsp_t
/* memory manager */ /* memory manager */
xp_lsp_mem_t* mem; xp_lsp_mem_t* mem;
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
* $Id: name.c,v 1.2 2005-09-18 11:34:35 bacon Exp $ * $Id: name.c,v 1.3 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/lsp/name.h> #include <xp/lsp/name.h>
@ -16,9 +16,9 @@ xp_lsp_name_t* xp_lsp_name_open (
name = (xp_lsp_name_t*) name = (xp_lsp_name_t*)
xp_malloc (xp_sizeof(xp_lsp_name_t)); xp_malloc (xp_sizeof(xp_lsp_name_t));
if (name == XP_NULL) return XP_NULL; if (name == XP_NULL) return XP_NULL;
name->__malloced = xp_true; name->__dynamic = xp_true;
} }
else name->__malloced = xp_false; else name->__dynamic = xp_false;
if (capacity < xp_countof(name->static_buffer)) { if (capacity < xp_countof(name->static_buffer)) {
name->buffer = name->static_buffer; name->buffer = name->static_buffer;
@ -27,7 +27,7 @@ xp_lsp_name_t* xp_lsp_name_open (
name->buffer = (xp_char_t*) name->buffer = (xp_char_t*)
xp_malloc ((capacity + 1) * xp_sizeof(xp_char_t)); xp_malloc ((capacity + 1) * xp_sizeof(xp_char_t));
if (name->buffer == XP_NULL) { if (name->buffer == XP_NULL) {
if (name->__malloced) xp_free (name); if (name->__dynamic) xp_free (name);
return XP_NULL; return XP_NULL;
} }
} }
@ -45,7 +45,7 @@ void xp_lsp_name_close (xp_lsp_name_t* name)
xp_assert (name->buffer != name->static_buffer); xp_assert (name->buffer != name->static_buffer);
xp_free (name->buffer); xp_free (name->buffer);
} }
if (name->__malloced) xp_free (name); if (name->__dynamic) xp_free (name);
} }
int xp_lsp_name_addc (xp_lsp_name_t* name, xp_cint_t c) int xp_lsp_name_addc (xp_lsp_name_t* name, xp_cint_t c)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: name.h,v 1.2 2005-09-18 10:18:35 bacon Exp $ * $Id: name.h,v 1.3 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_LSP_NAME_H_ #ifndef _XP_LSP_NAME_H_
@ -14,7 +14,7 @@ struct xp_lsp_name_t
xp_word_t size; xp_word_t size;
xp_char_t* buffer; xp_char_t* buffer;
xp_char_t static_buffer[128]; xp_char_t static_buffer[128];
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
typedef struct xp_lsp_name_t xp_lsp_name_t; typedef struct xp_lsp_name_t xp_lsp_name_t;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: token.c,v 1.11 2005-09-18 08:10:50 bacon Exp $ * $Id: token.c,v 1.12 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/lsp/token.h> #include <xp/lsp/token.h>
@ -12,12 +12,12 @@ xp_lsp_token_t* xp_lsp_token_open (
token = (xp_lsp_token_t*) token = (xp_lsp_token_t*)
xp_malloc (xp_sizeof(xp_lsp_token_t)); xp_malloc (xp_sizeof(xp_lsp_token_t));
if (token == XP_NULL) return XP_NULL; if (token == XP_NULL) return XP_NULL;
token->__malloced = xp_true; token->__dynamic = xp_true;
} }
else token->__malloced = xp_false; else token->__dynamic = xp_false;
if (xp_lsp_name_open(&token->name, capacity) == XP_NULL) { if (xp_lsp_name_open(&token->name, capacity) == XP_NULL) {
if (token->__malloced) xp_free (token); if (token->__dynamic) xp_free (token);
return XP_NULL; return XP_NULL;
} }
@ -32,7 +32,7 @@ xp_lsp_token_t* xp_lsp_token_open (
void xp_lsp_token_close (xp_lsp_token_t* token) void xp_lsp_token_close (xp_lsp_token_t* token)
{ {
xp_lsp_name_close (&token->name); xp_lsp_name_close (&token->name);
if (token->__malloced) xp_free (token); if (token->__dynamic) xp_free (token);
} }
int xp_lsp_token_addc (xp_lsp_token_t* token, xp_cint_t c) int xp_lsp_token_addc (xp_lsp_token_t* token, xp_cint_t c)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: token.h,v 1.10 2005-09-20 11:19:15 bacon Exp $ * $Id: token.h,v 1.11 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_LSP_TOKEN_H_ #ifndef _XP_LSP_TOKEN_H_
@ -21,7 +21,7 @@ struct xp_lsp_token_t
xp_lsp_real_t rvalue; xp_lsp_real_t rvalue;
xp_lsp_name_t name; xp_lsp_name_t name;
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
typedef struct xp_lsp_token_t xp_lsp_token_t; typedef struct xp_lsp_token_t xp_lsp_token_t;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: memory.c,v 1.12 2005-06-08 16:00:51 bacon Exp $ * $Id: memory.c,v 1.13 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/stx/memory.h> #include <xp/stx/memory.h>
@ -15,14 +15,14 @@ xp_stx_memory_t* xp_stx_memory_open (
if (mem == XP_NULL) { if (mem == XP_NULL) {
mem = (xp_stx_memory_t*)xp_malloc(xp_sizeof(xp_stx_memory_t)); mem = (xp_stx_memory_t*)xp_malloc(xp_sizeof(xp_stx_memory_t));
if (mem == XP_NULL) return XP_NULL; if (mem == XP_NULL) return XP_NULL;
mem->__malloced = xp_true; mem->__dynamic = xp_true;
} }
else mem->__malloced = xp_false; else mem->__dynamic = xp_false;
slots = (xp_stx_object_t**)xp_malloc ( slots = (xp_stx_object_t**)xp_malloc (
capacity * xp_sizeof(xp_stx_object_t*)); capacity * xp_sizeof(xp_stx_object_t*));
if (slots == XP_NULL) { if (slots == XP_NULL) {
if (mem->__malloced) xp_free (mem); if (mem->__dynamic) xp_free (mem);
mem = XP_NULL; mem = XP_NULL;
} }
@ -47,7 +47,7 @@ void xp_stx_memory_close (xp_stx_memory_t* mem)
mem->capacity = 0; mem->capacity = 0;
mem->slots = XP_NULL; mem->slots = XP_NULL;
mem->free = XP_NULL; mem->free = XP_NULL;
if (mem->__malloced) xp_free (mem); if (mem->__dynamic) xp_free (mem);
} }
void xp_stx_memory_gc (xp_stx_memory_t* mem) void xp_stx_memory_gc (xp_stx_memory_t* mem)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: name.c,v 1.2 2005-07-12 16:16:42 bacon Exp $ * $Id: name.c,v 1.3 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/stx/name.h> #include <xp/stx/name.h>
@ -15,9 +15,9 @@ xp_stx_name_t* xp_stx_name_open (
name = (xp_stx_name_t*) name = (xp_stx_name_t*)
xp_malloc (xp_sizeof(xp_stx_name_t)); xp_malloc (xp_sizeof(xp_stx_name_t));
if (name == XP_NULL) return XP_NULL; if (name == XP_NULL) return XP_NULL;
name->__malloced = xp_true; name->__dynamic = xp_true;
} }
else name->__malloced = xp_false; else name->__dynamic = xp_false;
if (capacity < xp_countof(name->static_buffer)) { if (capacity < xp_countof(name->static_buffer)) {
name->buffer = name->static_buffer; name->buffer = name->static_buffer;
@ -26,7 +26,7 @@ xp_stx_name_t* xp_stx_name_open (
name->buffer = (xp_char_t*) name->buffer = (xp_char_t*)
xp_malloc ((capacity + 1) * xp_sizeof(xp_char_t)); xp_malloc ((capacity + 1) * xp_sizeof(xp_char_t));
if (name->buffer == XP_NULL) { if (name->buffer == XP_NULL) {
if (name->__malloced) xp_free (name); if (name->__dynamic) xp_free (name);
return XP_NULL; return XP_NULL;
} }
} }
@ -44,7 +44,7 @@ void xp_stx_name_close (xp_stx_name_t* name)
xp_assert (name->buffer != name->static_buffer); xp_assert (name->buffer != name->static_buffer);
xp_free (name->buffer); xp_free (name->buffer);
} }
if (name->__malloced) xp_free (name); if (name->__dynamic) xp_free (name);
} }
int xp_stx_name_addc (xp_stx_name_t* name, xp_cint_t c) int xp_stx_name_addc (xp_stx_name_t* name, xp_cint_t c)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: name.h,v 1.3 2005-08-18 15:28:18 bacon Exp $ * $Id: name.h,v 1.4 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_STX_NAME_H_ #ifndef _XP_STX_NAME_H_
@ -13,7 +13,7 @@ struct xp_stx_name_t
xp_word_t size; xp_word_t size;
xp_char_t* buffer; xp_char_t* buffer;
xp_char_t static_buffer[128]; xp_char_t static_buffer[128];
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
typedef struct xp_stx_name_t xp_stx_name_t; typedef struct xp_stx_name_t xp_stx_name_t;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: parser.c,v 1.78 2005-10-02 15:45:09 bacon Exp $ * $Id: parser.c,v 1.79 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/stx/parser.h> #include <xp/stx/parser.h>
@ -66,18 +66,18 @@ xp_stx_parser_t* xp_stx_parser_open (xp_stx_parser_t* parser, xp_stx_t* stx)
parser = (xp_stx_parser_t*) parser = (xp_stx_parser_t*)
xp_malloc (xp_sizeof(xp_stx_parser_t)); xp_malloc (xp_sizeof(xp_stx_parser_t));
if (parser == XP_NULL) return XP_NULL; if (parser == XP_NULL) return XP_NULL;
parser->__malloced = xp_true; parser->__dynamic = xp_true;
} }
else parser->__malloced = xp_false; else parser->__dynamic = xp_false;
if (xp_stx_name_open (&parser->method_name, 0) == XP_NULL) { if (xp_stx_name_open (&parser->method_name, 0) == XP_NULL) {
if (parser->__malloced) xp_free (parser); if (parser->__dynamic) xp_free (parser);
return XP_NULL; return XP_NULL;
} }
if (xp_stx_token_open (&parser->token, 0) == XP_NULL) { if (xp_stx_token_open (&parser->token, 0) == XP_NULL) {
xp_stx_name_close (&parser->method_name); xp_stx_name_close (&parser->method_name);
if (parser->__malloced) xp_free (parser); if (parser->__dynamic) xp_free (parser);
return XP_NULL; return XP_NULL;
} }
@ -86,7 +86,7 @@ xp_stx_parser_t* xp_stx_parser_open (xp_stx_parser_t* parser, xp_stx_t* stx)
xp_sizeof(xp_byte_t), XP_NULL) == XP_NULL) { xp_sizeof(xp_byte_t), XP_NULL) == XP_NULL) {
xp_stx_name_close (&parser->method_name); xp_stx_name_close (&parser->method_name);
xp_stx_token_close (&parser->token); xp_stx_token_close (&parser->token);
if (parser->__malloced) xp_free (parser); if (parser->__dynamic) xp_free (parser);
return XP_NULL; return XP_NULL;
} }
@ -116,7 +116,7 @@ void xp_stx_parser_close (xp_stx_parser_t* parser)
xp_stx_name_close (&parser->method_name); xp_stx_name_close (&parser->method_name);
xp_stx_token_close (&parser->token); xp_stx_token_close (&parser->token);
if (parser->__malloced) xp_free (parser); if (parser->__dynamic) xp_free (parser);
} }
#define GET_CHAR(parser) \ #define GET_CHAR(parser) \

View File

@ -1,5 +1,5 @@
/* /*
* $Id: parser.h,v 1.34 2005-08-18 15:28:18 bacon Exp $ * $Id: parser.h,v 1.35 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_STX_PARSER_H_ #ifndef _XP_STX_PARSER_H_
@ -86,7 +86,7 @@ struct xp_stx_parser_t
void* input_owner; void* input_owner;
int (*input_func) (int cmd, void* owner, void* arg); int (*input_func) (int cmd, void* owner, void* arg);
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stx.c,v 1.39 2005-08-18 15:28:18 bacon Exp $ * $Id: stx.c,v 1.40 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/stx/stx.h> #include <xp/stx/stx.h>
@ -13,12 +13,12 @@ xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity)
if (stx == XP_NULL) { if (stx == XP_NULL) {
stx = (xp_stx_t*)xp_malloc (xp_sizeof(stx)); stx = (xp_stx_t*)xp_malloc (xp_sizeof(stx));
if (stx == XP_NULL) return XP_NULL; if (stx == XP_NULL) return XP_NULL;
stx->__malloced = xp_true; stx->__dynamic = xp_true;
} }
else stx->__malloced = xp_false; else stx->__dynamic = xp_false;
if (xp_stx_memory_open (&stx->memory, capacity) == XP_NULL) { if (xp_stx_memory_open (&stx->memory, capacity) == XP_NULL) {
if (stx->__malloced) xp_free (stx); if (stx->__dynamic) xp_free (stx);
return XP_NULL; return XP_NULL;
} }
@ -28,7 +28,7 @@ xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity)
xp_sizeof(xp_word_t) * stx->symtab.capacity); xp_sizeof(xp_word_t) * stx->symtab.capacity);
if (stx->symtab.datum == XP_NULL) { if (stx->symtab.datum == XP_NULL) {
xp_stx_memory_close (&stx->memory); xp_stx_memory_close (&stx->memory);
if (stx->__malloced) xp_free (stx); if (stx->__dynamic) xp_free (stx);
return XP_NULL; return XP_NULL;
} }
@ -65,6 +65,6 @@ void xp_stx_close (xp_stx_t* stx)
{ {
xp_free (stx->symtab.datum); xp_free (stx->symtab.datum);
xp_stx_memory_close (&stx->memory); xp_stx_memory_close (&stx->memory);
if (stx->__malloced) xp_free (stx); if (stx->__dynamic) xp_free (stx);
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stx.h,v 1.44 2005-09-30 12:19:00 bacon Exp $ * $Id: stx.h,v 1.45 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_STX_STX_H_ #ifndef _XP_STX_STX_H_
@ -56,7 +56,7 @@ struct xp_stx_memory_t
xp_word_t capacity; xp_word_t capacity;
xp_stx_object_t** slots; xp_stx_object_t** slots;
xp_stx_object_t** free; xp_stx_object_t** free;
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
struct xp_stx_symtab_t struct xp_stx_symtab_t
@ -92,7 +92,7 @@ struct xp_stx_t
xp_word_t class_method; xp_word_t class_method;
xp_word_t class_smallinteger; xp_word_t class_smallinteger;
xp_bool_t __malloced; xp_bool_t __dynamic;
xp_bool_t __wantabort; /* TODO: make it a function pointer */ xp_bool_t __wantabort; /* TODO: make it a function pointer */
}; };

View File

@ -1,5 +1,5 @@
/* /*
* $Id: token.c,v 1.9 2005-06-12 16:22:03 bacon Exp $ * $Id: token.c,v 1.10 2005-12-05 15:11:29 bacon Exp $
*/ */
#include <xp/stx/token.h> #include <xp/stx/token.h>
@ -12,12 +12,12 @@ xp_stx_token_t* xp_stx_token_open (
token = (xp_stx_token_t*) token = (xp_stx_token_t*)
xp_malloc (xp_sizeof(xp_stx_token_t)); xp_malloc (xp_sizeof(xp_stx_token_t));
if (token == XP_NULL) return XP_NULL; if (token == XP_NULL) return XP_NULL;
token->__malloced = xp_true; token->__dynamic = xp_true;
} }
else token->__malloced = xp_false; else token->__dynamic = xp_false;
if (xp_stx_name_open(&token->name, capacity) == XP_NULL) { if (xp_stx_name_open(&token->name, capacity) == XP_NULL) {
if (token->__malloced) xp_free (token); if (token->__dynamic) xp_free (token);
return XP_NULL; return XP_NULL;
} }
@ -32,7 +32,7 @@ xp_stx_token_t* xp_stx_token_open (
void xp_stx_token_close (xp_stx_token_t* token) void xp_stx_token_close (xp_stx_token_t* token)
{ {
xp_stx_name_close (&token->name); xp_stx_name_close (&token->name);
if (token->__malloced) xp_free (token); if (token->__dynamic) xp_free (token);
} }
int xp_stx_token_addc (xp_stx_token_t* token, xp_cint_t c) int xp_stx_token_addc (xp_stx_token_t* token, xp_cint_t c)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: token.h,v 1.17 2005-06-23 04:55:44 bacon Exp $ * $Id: token.h,v 1.18 2005-12-05 15:11:29 bacon Exp $
*/ */
#ifndef _XP_STX_TOKEN_H_ #ifndef _XP_STX_TOKEN_H_
@ -40,7 +40,7 @@ struct xp_stx_token_t
xp_stx_real_t fvalue; xp_stx_real_t fvalue;
*/ */
xp_stx_name_t name; xp_stx_name_t name;
xp_bool_t __malloced; xp_bool_t __dynamic;
}; };
typedef struct xp_stx_token_t xp_stx_token_t; typedef struct xp_stx_token_t xp_stx_token_t;