ruby-changes:46920
From: nobu <ko1@a...>
Date: Wed, 7 Jun 2017 23:36:25 +0900 (JST)
Subject: [ruby-changes:46920] nobu:r59035 (trunk): load.c: get rid of side effects
nobu 2017-06-07 23:36:18 +0900 (Wed, 07 Jun 2017) New Revision: 59035 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59035 Log: load.c: get rid of side effects * load.c (rb_f_load, rb_require_internal): DTrace hooks should not have side effects, i.e., conversion to String. Modified files: trunk/load.c Index: load.c =================================================================== --- load.c (revision 59034) +++ load.c (revision 59035) @@ -701,10 +701,10 @@ rb_f_load(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/load.c#L701 rb_scan_args(argc, argv, "11", &fname, &wrap); - RUBY_DTRACE_HOOK(LOAD_ENTRY, StringValuePtr(fname)); - orig_fname = rb_get_path_check_to_string(fname, rb_safe_level()); fname = rb_str_encode_ospath(orig_fname); + RUBY_DTRACE_HOOK(LOAD_ENTRY, RSTRING_PTR(orig_fname)); + path = rb_find_file(fname); if (!path) { if (!rb_file_load_ok(RSTRING_PTR(fname))) @@ -713,7 +713,7 @@ rb_f_load(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/load.c#L713 } rb_load_internal(path, RTEST(wrap)); - RUBY_DTRACE_HOOK(LOAD_RETURN, StringValuePtr(fname)); + RUBY_DTRACE_HOOK(LOAD_RETURN, RSTRING_PTR(orig_fname)); return Qtrue; } @@ -968,10 +968,9 @@ rb_require_internal(VALUE fname, int saf https://github.com/ruby/ruby/blob/trunk/load.c#L968 char *volatile ftptr = 0; VALUE path; - RUBY_DTRACE_HOOK(REQUIRE_ENTRY, StringValuePtr(fname)); - fname = rb_get_path_check(fname, safe); path = rb_str_encode_ospath(fname); + RUBY_DTRACE_HOOK(REQUIRE_ENTRY, RSTRING_PTR(fname)); TH_PUSH_TAG(th); saved.safe = rb_safe_level(); @@ -981,9 +980,9 @@ rb_require_internal(VALUE fname, int saf https://github.com/ruby/ruby/blob/trunk/load.c#L980 rb_set_safe_level_force(0); - RUBY_DTRACE_HOOK(FIND_REQUIRE_ENTRY, StringValuePtr(fname)); + RUBY_DTRACE_HOOK(FIND_REQUIRE_ENTRY, RSTRING_PTR(fname)); found = search_required(path, &path, safe); - RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, StringValuePtr(fname)); + RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, RSTRING_PTR(fname)); if (found) { if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) { @@ -1024,7 +1023,7 @@ rb_require_internal(VALUE fname, int saf https://github.com/ruby/ruby/blob/trunk/load.c#L1023 th->errinfo = errinfo; - RUBY_DTRACE_HOOK(REQUIRE_RETURN, StringValuePtr(fname)); + RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname)); return result; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/