From 017d4ff10ae32ed6570b5d33a8106bd1f22e008f Mon Sep 17 00:00:00 2001 From: why Date: Thu, 5 Jun 2003 04:43:05 +0000 Subject: * ext/syck/token.c: directives choked on a period. * ext/syck/gram.y: anchors work above a collection. [ruby-core:1071] * ext/syck/handler.c, ext/syck/syck.c: ensure a fresh strtable between parser iterations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/syck/syck.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'ext/syck/syck.c') diff --git a/ext/syck/syck.c b/ext/syck/syck.c index 068c1952cf..18623ffb26 100644 --- a/ext/syck/syck.c +++ b/ext/syck/syck.c @@ -169,7 +169,7 @@ syck_new_parser() p->io_type = syck_io_str; p->io.str = NULL; p->syms = NULL; - p->anchors = st_init_strtable(); + p->anchors = NULL; p->implicit_typing = 1; p->taguri_expansion = 0; p->bufsize = SYCK_BUFFERSIZE; @@ -207,28 +207,38 @@ syck_st_free_nodes( char *key, SyckNode *n, char *arg ) } void -syck_free_parser( SyckParser *p ) +syck_st_free( SyckParser *p ) { - char *key; - SyckNode *node; - // // Free the adhoc symbol table // if ( p->syms != NULL ) { st_free_table( p->syms ); + p->syms = NULL; } // // Free the anchor table // - st_foreach( p->anchors, syck_st_free_nodes, 0 ); - st_free_table( p->anchors ); + if ( p->anchors != NULL ) + { + st_foreach( p->anchors, syck_st_free_nodes, 0 ); + st_free_table( p->anchors ); + p->anchors = NULL; + } +} + +void +syck_free_parser( SyckParser *p ) +{ + char *key; + SyckNode *node; // - // Free all else + // Free tables, levels // + syck_st_free( p ); syck_parser_reset_levels( p ); S_FREE( p->levels[0].domain ); S_FREE( p->levels ); @@ -467,6 +477,7 @@ syck_parse( SyckParser *p ) ASSERT( p != NULL ); + syck_st_free( p ); syck_parser_reset_levels( p ); yyparse( p ); return p->root; -- cgit v1.2.3