mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Do no use return values from mrb_ensure_ functions.
They return the checking argument without modification, so the values are already there. Maybe we should change the return type to `void` but keep them unchanged for compatibility.
This commit is contained in:
@@ -195,14 +195,14 @@ static mrb_value
|
||||
mrb_str_start_with(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
const mrb_value *argv;
|
||||
mrb_value sub;
|
||||
mrb_int argc, i;
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
size_t len_l, len_r;
|
||||
int ai = mrb_gc_arena_save(mrb);
|
||||
sub = mrb_ensure_string_type(mrb, argv[i]);
|
||||
mrb_value sub = argv[i];
|
||||
mrb_ensure_string_type(mrb, sub);
|
||||
mrb_gc_arena_restore(mrb, ai);
|
||||
len_l = RSTRING_LEN(self);
|
||||
len_r = RSTRING_LEN(sub);
|
||||
@@ -225,14 +225,14 @@ static mrb_value
|
||||
mrb_str_end_with(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
const mrb_value *argv;
|
||||
mrb_value sub;
|
||||
mrb_int argc, i;
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
size_t len_l, len_r;
|
||||
int ai = mrb_gc_arena_save(mrb);
|
||||
sub = mrb_ensure_string_type(mrb, argv[i]);
|
||||
mrb_value sub = argv[i];
|
||||
mrb_ensure_string_type(mrb, sub);
|
||||
mrb_gc_arena_restore(mrb, ai);
|
||||
len_l = RSTRING_LEN(self);
|
||||
len_r = RSTRING_LEN(sub);
|
||||
|
||||
Reference in New Issue
Block a user