From cbb56e30a4bc3d0f1446bdd3fb41f14a362e94fb Mon Sep 17 00:00:00 2001 From: tmm1 Date: Tue, 26 Nov 2013 23:30:25 +0000 Subject: * compile.c: Use rb_fstring() to de-duplicate string literals in code. [ruby-core:58599] [Bug #9159] [ruby-core:54405] * iseq.c (prepare_iseq_build): De-duplicate iseq labels and source locations. * re.c (rb_reg_initialize): Use rb_fstring() for regex string. * string.c (rb_fstring): Handle non-string and already-fstr arguments. * vm_eval.c (eval_string_with_cref): De-duplicate eval source filename. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'string.c') diff --git a/string.c b/string.c index fa5d2990fb..c6c1497ea4 100644 --- a/string.c +++ b/string.c @@ -136,6 +136,11 @@ VALUE rb_fstring(VALUE str) { st_data_t fstr; + Check_Type(str, T_STRING); + + if (FL_TEST(str, RSTRING_FSTR)) + return str; + if (st_lookup(frozen_strings, (st_data_t)str, &fstr)) { str = (VALUE)fstr; /* because of lazy sweep, str may be unmaked already and swept -- cgit v1.2.3