diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-10-17 15:23:32 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-10-17 15:23:32 +0900 |
| commit | 3c20c96f840d40950f4da61bd93f773a83767aef (patch) | |
| tree | b74114ea4a9458cff1b3603eedfe0c20f5742197 /mrbgems/mruby-string-ext/src/string.c | |
| parent | b890528a183caf2f4161983a147508f65af8c700 (diff) | |
| download | mruby-3c20c96f840d40950f4da61bd93f773a83767aef.tar.gz mruby-3c20c96f840d40950f4da61bd93f773a83767aef.zip | |
Use a new function: `mrb_get_argc()`; ref #3826
Diffstat (limited to 'mrbgems/mruby-string-ext/src/string.c')
| -rw-r--r-- | mrbgems/mruby-string-ext/src/string.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c index 612fc5335..5195a7ba0 100644 --- a/mrbgems/mruby-string-ext/src/string.c +++ b/mrbgems/mruby-string-ext/src/string.c @@ -44,12 +44,13 @@ mrb_str_byteslice(mrb_state *mrb, mrb_value str) { mrb_value a1; mrb_int len; - mrb_int argc; - argc = mrb_get_args(mrb, "o|i", &a1, &len); - if (argc == 2) { + if (mrb_get_argc(mrb) == 2) { + mrb_int pos; + mrb_get_args(mrb, "ii", &pos, &len); return mrb_str_substr(mrb, str, mrb_fixnum(a1), len); } + mrb_get_args(mrb, "o|i", &a1, &len); switch (mrb_type(a1)) { case MRB_TT_RANGE: { |
