* ext/psych/parser.c: Fixing a segv in test-all. Thanks Yusuke!

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2010-04-10 23:50:50 +00:00
parent 7be704b359
commit b9617bf7cb

View File

@ -57,10 +57,10 @@ static VALUE parse(VALUE self, VALUE yaml)
if(rb_respond_to(yaml, id_read)) {
yaml_parser_set_input(&parser, io_reader, (void *)yaml);
} else {
Check_Type(yaml, T_STRING);
StringValue(yaml);
yaml_parser_set_input_string(
&parser,
(const unsigned char *)StringValuePtr(yaml),
(const unsigned char *)RSTRING_PTR(yaml),
(size_t)RSTRING_LEN(yaml)
);
}