summaryrefslogtreecommitdiff
path: root/ext/syck/syck.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-05 04:43:05 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-05 04:43:05 +0000
commit017d4ff10ae32ed6570b5d33a8106bd1f22e008f (patch)
treec0485110aa5ea341f821cb6bfa210041b71813e3 /ext/syck/syck.c
parent45c7ea552d0293aa217bbb496d4238754ba701d2 (diff)
* 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
Diffstat (limited to 'ext/syck/syck.c')
-rw-r--r--ext/syck/syck.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
index 068c1952cf0..18623ffb266 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;