summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-01-04 23:07:57 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-01-06 15:52:39 +0900
commit111045ecada16d3c047b90a26a1ec0af06e5a323 (patch)
tree1832fd804e79961e2cf2496f96cf4adcef5edc6f /mrbgems/mruby-compiler/core/codegen.c
parent282f907f1bf172b60043f886020f1051e127b446 (diff)
downloadmruby-111045ecada16d3c047b90a26a1ec0af06e5a323.tar.gz
mruby-111045ecada16d3c047b90a26a1ec0af06e5a323.zip
Avoid creating temporary objects in `read_irep_record_1`; close #4920
The basic idea of this change is from @dearblue. Note: the arguments of `mrb_str_pool()` have changed, but the function is provided for internal use (No `MRB_API`). So basically you don't have to worry about the change.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 24bc791d0..717d9eb9a 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -599,7 +599,7 @@ new_lit(codegen_scope *s, mrb_value val)
switch (mrb_type(val)) {
case MRB_TT_STRING:
- *pv = mrb_str_pool(s->mrb, val);
+ *pv = mrb_str_pool(s->mrb, RSTRING_PTR(val), RSTRING_LEN(val), RSTR_NOFREE_P(RSTRING(val)));
break;
#ifndef MRB_WITHOUT_FLOAT