summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-07 14:36:18 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-07 14:36:18 (GMT)
commit942dbb02387a1fdd411713c095fefa1a293c4709 (patch)
tree7d7bf0415e927710069702144ff90bc555647dd0 /load.c
parent0911dd2a97686d26013d73432d51e7a58123cab8 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/load.c b/load.c
index 1304f1b..7329dd5 100644
--- a/load.c
+++ b/load.c
@@ -701,10 +701,10 @@ rb_f_load(int argc, VALUE *argv)
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)
}
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 safe)
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 safe)
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 safe)
th->errinfo = errinfo;
- RUBY_DTRACE_HOOK(REQUIRE_RETURN, StringValuePtr(fname));
+ RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname));
return result;
}