mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
YAML parser don't need identity hash.
revert the part of previous commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dfc3fccef3
commit
97ed18f1da
2 changed files with 13 additions and 15 deletions
|
@ -1,10 +1,8 @@
|
||||||
Sat Aug 22 13:46:15 2009 Tanaka Akira <akr@fsij.org>
|
Sat Aug 22 15:07:23 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/syck/rubyext.c (id_hash_new): new function to create a hash
|
* ext/syck/rubyext.c (id_hash_new): new function to create a hash
|
||||||
which key is compared by object id.
|
which key is compared by object id.
|
||||||
(syck_parser_load): use id_hash_new for bonus->data.
|
(syck_emitter_reset): use id_hash_new for bonus->data.
|
||||||
(syck_parser_load_documents): ditto.
|
|
||||||
(syck_emitter_reset): ditto.
|
|
||||||
|
|
||||||
* lib/yaml.rb (YAML.quick_emit): give the object itself to eimitter.
|
* lib/yaml.rb (YAML.quick_emit): give the object itself to eimitter.
|
||||||
don't use object_id and hash.
|
don't use object_id and hash.
|
||||||
|
|
|
@ -837,15 +837,6 @@ syck_parser_bufsize_get(VALUE self)
|
||||||
return INT2FIX( parser->bufsize );
|
return INT2FIX( parser->bufsize );
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
id_hash_new(void)
|
|
||||||
{
|
|
||||||
VALUE hash;
|
|
||||||
hash = rb_hash_new();
|
|
||||||
rb_funcall(hash, rb_intern("compare_by_identity"), 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* YAML::Syck::Parser.load( IO or String )
|
* YAML::Syck::Parser.load( IO or String )
|
||||||
*/
|
*/
|
||||||
|
@ -865,7 +856,7 @@ syck_parser_load(int argc, VALUE *argv, VALUE self)
|
||||||
|
|
||||||
bonus = (struct parser_xtra *)parser->bonus;
|
bonus = (struct parser_xtra *)parser->bonus;
|
||||||
bonus->taint = syck_parser_assign_io(parser, &port);
|
bonus->taint = syck_parser_assign_io(parser, &port);
|
||||||
bonus->data = id_hash_new();
|
bonus->data = rb_hash_new();
|
||||||
bonus->resolver = rb_attr_get( self, s_resolver );
|
bonus->resolver = rb_attr_get( self, s_resolver );
|
||||||
if ( NIL_P( proc ) ) bonus->proc = 0;
|
if ( NIL_P( proc ) ) bonus->proc = 0;
|
||||||
else bonus->proc = proc;
|
else bonus->proc = proc;
|
||||||
|
@ -898,7 +889,7 @@ syck_parser_load_documents(int argc, VALUE *argv, VALUE self)
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
/* Reset hash for tracking nodes */
|
/* Reset hash for tracking nodes */
|
||||||
bonus->data = id_hash_new();
|
bonus->data = rb_hash_new();
|
||||||
|
|
||||||
/* Parse a document */
|
/* Parse a document */
|
||||||
v = syck_parse( parser );
|
v = syck_parse( parser );
|
||||||
|
@ -1947,6 +1938,15 @@ syck_emitter_s_alloc(VALUE class)
|
||||||
return pobj;
|
return pobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
id_hash_new(void)
|
||||||
|
{
|
||||||
|
VALUE hash;
|
||||||
|
hash = rb_hash_new();
|
||||||
|
rb_funcall(hash, rb_intern("compare_by_identity"), 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* YAML::Syck::Emitter.reset( options )
|
* YAML::Syck::Emitter.reset( options )
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue