summaryrefslogtreecommitdiff
path: root/vm_eval.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
commitfa8b08b4248d66a172369f4654fec9bdba8c748f (patch)
treeb1217f07f36c92fca08b5f5ee720dc5596de17ff /vm_eval.c
parent83a01e6f529b80a876508b9501b64e8f1f1414da (diff)
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_eval.c')
-rw-r--r--vm_eval.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/vm_eval.c b/vm_eval.c
index cbc454d..09c86dc 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -644,7 +644,7 @@ rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
VALUE name = argv[0];
if (!format) {
- format = rb_fstring_cstr("undefined method `%s' for %s%s%s");
+ format = rb_fstring_lit("undefined method `%s' for %s%s%s");
}
if (exc == rb_eNoMethodError) {
VALUE args = rb_ary_new4(argc - 1, argv + 1);
@@ -676,17 +676,17 @@ raise_method_missing(rb_execution_context_t *ec, int argc, const VALUE *argv, VA
stack_check(ec);
if (last_call_status & MISSING_PRIVATE) {
- format = rb_fstring_cstr("private method `%s' called for %s%s%s");
+ format = rb_fstring_lit("private method `%s' called for %s%s%s");
}
else if (last_call_status & MISSING_PROTECTED) {
- format = rb_fstring_cstr("protected method `%s' called for %s%s%s");
+ format = rb_fstring_lit("protected method `%s' called for %s%s%s");
}
else if (last_call_status & MISSING_VCALL) {
- format = rb_fstring_cstr("undefined local variable or method `%s' for %s%s%s");
+ format = rb_fstring_lit("undefined local variable or method `%s' for %s%s%s");
exc = rb_eNameError;
}
else if (last_call_status & MISSING_SUPER) {
- format = rb_fstring_cstr("super: no superclass method `%s' for %s%s%s");
+ format = rb_fstring_lit("super: no superclass method `%s' for %s%s%s");
}
{