summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-10 04:38:23 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-10 04:38:23 +0000
commit0f8bc84d639b1f96f29ba2a9d62e648a84445504 (patch)
tree8fbd2d40701d87be45c26f0314d004ebb9816bc8 /ext
parent6b3533ed4c70cdd11bd8f19234cf29e8eb84343a (diff)
downloadruby-0f8bc84d639b1f96f29ba2a9d62e648a84445504.tar.gz
ruby-0f8bc84d639b1f96f29ba2a9d62e648a84445504.tar.xz
ruby-0f8bc84d639b1f96f29ba2a9d62e648a84445504.zip
* ext/syck/rubyext.c (syck_resolver_transfer): should be able to load
!ruby/object:Bignum syntax 1.8.3 dumped. [ruby-core:6159] (written by akira yamada) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/syck/rubyext.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
index 192e6c46c..a4717e4f3 100644
--- a/ext/syck/rubyext.c
+++ b/ext/syck/rubyext.c
@@ -115,14 +115,14 @@ rb_syck_compile(self, port)
oid = syck_parse( parser );
syck_lookup_sym( parser, oid, (char **)&sav );
- ret = S_ALLOCA_N( char, strlen( sav->buffer ) + 3 );
+ ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
ret[0] = '\0';
strcat( ret, "D\n" );
strcat( ret, sav->buffer );
syck_free_parser( parser );
- bc = rb_str_new2( ret );
+ bc = rb_str_new2( ret ); S_FREE( ret );
if ( taint ) OBJ_TAINT( bc );
return bc;
}
@@ -1038,16 +1038,17 @@ syck_resolver_node_import( self, node )
*/
VALUE
syck_set_ivars( vars, obj )
- VALUE vars, obj;
+ VALUE vars, obj;
{
VALUE ivname = rb_ary_entry( vars, 0 );
char *ivn;
StringValue( ivname );
- ivn = S_ALLOCA_N( char, RSTRING(ivname)->len + 2 );
+ ivn = S_ALLOC_N( char, RSTRING(ivname)->len + 2 );
ivn[0] = '@';
ivn[1] = '\0';
strncat( ivn, RSTRING(ivname)->ptr, RSTRING(ivname)->len );
rb_iv_set( obj, ivn, rb_ary_entry( vars, 1 ) );
+ S_FREE( ivn );
return Qnil;
}
@@ -1156,7 +1157,15 @@ syck_resolver_transfer( self, type, val )
}
else if ( !NIL_P( target_class ) )
{
- obj = rb_obj_alloc( subclass );
+ if ( subclass == rb_cBignum )
+ {
+ obj = rb_str2inum( val, 10 ); /* for yaml dumped by 1.8.3 [ruby-core:6159] */
+ }
+ else
+ {
+ obj = rb_obj_alloc( subclass );
+ }
+
if ( rb_respond_to( obj, s_yaml_initialize ) )
{
rb_funcall( obj, s_yaml_initialize, 2, type, val );