diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-08-30 07:35:58 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-09-01 07:00:54 +0900 |
| commit | e86c9cb57c0ee799ca66d18612e15c6c8983f872 (patch) | |
| tree | f60224602ddf0cfb7bcca1546648b5d42d6e2a95 /mrbgems/mruby-string-ext | |
| parent | 572a43de8406da89daeaa9b433761da762d7b1c4 (diff) | |
| download | mruby-e86c9cb57c0ee799ca66d18612e15c6c8983f872.tar.gz mruby-e86c9cb57c0ee799ca66d18612e15c6c8983f872.zip | |
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.
Diffstat (limited to 'mrbgems/mruby-string-ext')
| -rw-r--r-- | mrbgems/mruby-string-ext/src/string.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c index f5f46c082..39ab94c26 100644 --- a/mrbgems/mruby-string-ext/src/string.c +++ b/mrbgems/mruby-string-ext/src/string.c @@ -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); |
