aboutsummaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 09:59:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 09:59:22 +0000
commitd815a071503c53988d6e20b934ff881ed0089ab4 (patch)
treeb1217f07f36c92fca08b5f5ee720dc5596de17ff /vm.c
parentd55e5f6f88ed03b3c9e10a4e813d1637a2e9db39 (diff)
downloadruby-d815a071503c53988d6e20b934ff881ed0089ab4.tar.gz
Prefer `rb_fstring_lit` over `rb_fstring_cstr`
The former states explicitly that the argument must be a literal, and can optimize away `strlen` on all compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vm.c b/vm.c
index 586bb84188..fababaa2ec 100644
--- a/vm.c
+++ b/vm.c
@@ -976,7 +976,7 @@ rb_binding_add_dynavars(VALUE bindval, rb_binding_t *bind, int dyncount, const I
iseq = rb_iseq_new(&ast, base_iseq->body->location.label, path, realpath, base_iseq, ISEQ_TYPE_EVAL);
}
else {
- VALUE tempstr = rb_fstring_cstr("<temp>");
+ VALUE tempstr = rb_fstring_lit("<temp>");
iseq = rb_iseq_new_top(&ast, tempstr, tempstr, tempstr, NULL);
}
tmp_node.nd_tbl = 0; /* reset table */
@@ -3098,7 +3098,7 @@ Init_VM(void)
{
rb_vm_t *vm = ruby_current_vm_ptr;
rb_thread_t *th = GET_THREAD();
- VALUE filename = rb_fstring_cstr("<main>");
+ VALUE filename = rb_fstring_lit("<main>");
const rb_iseq_t *iseq = rb_iseq_new(0, filename, filename, Qnil, 0, ISEQ_TYPE_TOP);
volatile VALUE th_self;