From fff358989970b6ac2d4e5971ee98ca1f8a32d639 Mon Sep 17 00:00:00 2001 From: charliesome Date: Mon, 24 Jun 2013 11:31:21 +0000 Subject: * compile.c (make_name_for_block): use PRIsVALUE in format string instead of %s and RSTRING_PTR to protect objects from being garbage collected too soon * encoding.c (str_to_encindex): ditto * hash.c (rb_hash_fetch_m): ditto * io.c (rb_io_reopen): ditto * parse.y (reg_fragment_check_gen): ditto * parse.y (reg_compile_gen): ditto * parse.y (ripper_assert_Qundef): ditto * re.c (rb_reg_raise): ditto * ruby.c (set_option_encoding_once): ditto * vm_eval.c (rb_throw_obj): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index c69556f70e..fa5609a649 100644 --- a/parse.y +++ b/parse.y @@ -9740,8 +9740,7 @@ reg_fragment_check_gen(struct parser_params* parser, VALUE str, int options) err = rb_reg_check_preprocess(str); if (err != Qnil) { err = rb_obj_as_string(err); - compile_error(PARSER_ARG "%s", RSTRING_PTR(err)); - RB_GC_GUARD(err); + compile_error(PARSER_ARG "%"PRIsVALUE, err); return 0; } return 1; @@ -9844,7 +9843,7 @@ reg_compile_gen(struct parser_params* parser, VALUE str, int options) rb_str_append(rb_str_cat(rb_attr_get(err, mesg), "\n", 1), m); } else { - compile_error(PARSER_ARG "%s", RSTRING_PTR(m)); + compile_error(PARSER_ARG "%"PRIsVALUE, m); } return Qnil; } @@ -11400,7 +11399,7 @@ ripper_assert_Qundef(VALUE self, VALUE obj, VALUE msg) { StringValue(msg); if (obj == Qundef) { - rb_raise(rb_eArgError, "%s", RSTRING_PTR(msg)); + rb_raise(rb_eArgError, "%"PRIsVALUE, msg); } return Qnil; } -- cgit v1.2.3