From fa8b08b4248d66a172369f4654fec9bdba8c748f Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 13 Oct 2018 09:59:22 +0000 Subject: 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 --- vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vm.c') 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(""); + VALUE tempstr = rb_fstring_lit(""); 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("
"); + VALUE filename = rb_fstring_lit("
"); const rb_iseq_t *iseq = rb_iseq_new(0, filename, filename, Qnil, 0, ISEQ_TYPE_TOP); volatile VALUE th_self; -- cgit v1.2.3