diff --git a/ase/stx/symbol.c b/ase/stx/symbol.c index a63c8853..87ae6c89 100644 --- a/ase/stx/symbol.c +++ b/ase/stx/symbol.c @@ -1,5 +1,5 @@ /* - * $Id: symbol.c,v 1.14 2005-07-07 07:45:05 bacon Exp $ + * $Id: symbol.c,v 1.15 2005-07-17 15:55:01 bacon Exp $ */ #include @@ -21,40 +21,7 @@ xp_word_t xp_stx_new_symlink (xp_stx_t* stx, xp_word_t sym) xp_word_t xp_stx_new_symbol (xp_stx_t* stx, const xp_char_t* name) { - xp_word_t x, hash, table, link, next; - - table = stx->symbol_table; - hash = xp_stx_strhash(name) % XP_STX_SIZE(stx,table); - link = XP_STX_WORDAT(stx,table,hash); - - if (link == stx->nil) { - x = xp_stx_alloc_char_object (stx, name); - XP_STX_CLASS(stx,x) = stx->class_symbol; - XP_STX_WORDAT(stx,table,hash) = xp_stx_new_symlink(stx,x); - } - else { - do { - x = XP_STX_WORDAT(stx,link,XP_STX_SYMLINK_SYMBOL); - xp_assert (XP_STX_CLASS(stx,x) == stx->class_symbol); - - if (xp_strxcmp ( - &XP_STX_CHARAT(stx,x,0), - XP_STX_SIZE(stx,x), name) == 0) return x; - - next = XP_STX_WORDAT(stx,link,XP_STX_SYMLINK_LINK); - if (next == stx->nil) { - x = xp_stx_alloc_char_object (stx, name); - XP_STX_CLASS(stx,x) = stx->class_symbol; - XP_STX_WORDAT(stx,link,XP_STX_SYMLINK_LINK) = - xp_stx_new_symlink(stx,x); - break; - } - - link = next; - } while (1); - } - - return x; + return xp_stx_new_symbolx (stx, name, xp_strlen(name)); } xp_word_t xp_stx_new_symbolx ( @@ -63,7 +30,7 @@ xp_word_t xp_stx_new_symbolx ( xp_word_t x, hash, table, link, next; table = stx->symbol_table; - hash = xp_stx_strhash(name) % XP_STX_SIZE(stx,table); + hash = xp_stx_strxhash(name,len) % XP_STX_SIZE(stx,table); link = XP_STX_WORDAT(stx,table,hash); if (link == stx->nil) { @@ -96,47 +63,6 @@ xp_word_t xp_stx_new_symbolx ( return x; } -xp_word_t xp_stx_new_symbol_pp ( - xp_stx_t* stx, const xp_char_t* name, - const xp_char_t* prefix, const xp_char_t* postfix) -{ - xp_word_t x, hash, table, link, next; - - table = stx->symbol_table; - hash = xp_stx_strhash(name) % XP_STX_SIZE(stx,table); - link = XP_STX_WORDAT(stx,table,hash); - - if (link == stx->nil) { - x = xp_stx_allocn_char_object (stx, prefix, name, postfix); - XP_STX_CLASS(stx,x) = stx->class_symbol; - XP_STX_WORDAT(stx,table,hash) = xp_stx_new_symlink(stx,x); - } - else { - do { - x = XP_STX_WORDAT(stx,link,XP_STX_SYMLINK_SYMBOL); - xp_assert (XP_STX_CLASS(stx,x) == stx->class_symbol); - - if (xp_strxcmp ( - &XP_STX_CHARAT(stx,x,0), - XP_STX_SIZE(stx,x), name) == 0) return x; - - next = XP_STX_WORDAT(stx,link,XP_STX_SYMLINK_LINK); - if (next == stx->nil) { - x = xp_stx_allocn_char_object (stx, prefix, name, postfix); - XP_STX_CLASS(stx,x) = stx->class_symbol; - XP_STX_WORDAT(stx,link,XP_STX_SYMLINK_LINK) = - xp_stx_new_symlink(stx,x); - break; - } - - link = next; - } while (1); - } - - - return x; -} - void xp_stx_traverse_symbol_table ( xp_stx_t* stx, void (*func) (xp_stx_t*,xp_word_t,void*), void* data) { diff --git a/ase/stx/symbol.h b/ase/stx/symbol.h index b0008ffc..92d16211 100644 --- a/ase/stx/symbol.h +++ b/ase/stx/symbol.h @@ -1,5 +1,5 @@ /* - * $Id: symbol.h,v 1.7 2005-07-07 07:45:05 bacon Exp $ + * $Id: symbol.h,v 1.8 2005-07-17 15:55:01 bacon Exp $ */ #ifndef _XP_STX_SYMBOL_H_ @@ -30,10 +30,6 @@ xp_word_t xp_stx_new_symbol ( xp_stx_t* stx, const xp_char_t* name); xp_word_t xp_stx_new_symbolx ( xp_stx_t* stx, const xp_char_t* name, xp_word_t len); - -xp_word_t xp_stx_new_symbol_pp ( - xp_stx_t* stx, const xp_char_t* name, - const xp_char_t* prefix, const xp_char_t* postfix); void xp_stx_traverse_symbol_table ( xp_stx_t* stx, void (*func) (xp_stx_t*,xp_word_t,void*), void* data);