Commit 2f8de5b3 authored by Jun Hiroe's avatar Jun Hiroe

Refactor mrb_str_split_m()

parent e340babc
...@@ -1851,7 +1851,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str) ...@@ -1851,7 +1851,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
char *ptr = RSTRING_PTR(str); char *ptr = RSTRING_PTR(str);
char *eptr = RSTRING_END(str); char *eptr = RSTRING_END(str);
char *bptr = ptr; char *bptr = ptr;
int skip = 1; mrb_bool skip = TRUE;
unsigned int c; unsigned int c;
end = beg; end = beg;
...@@ -1864,14 +1864,14 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str) ...@@ -1864,14 +1864,14 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
} }
else { else {
end = ptr - bptr; end = ptr - bptr;
skip = 0; skip = FALSE;
if (lim_p && lim <= i) break; if (lim_p && lim <= i) break;
} }
} }
else if (ascii_isspace(c)) { else if (ascii_isspace(c)) {
mrb_ary_push(mrb, result, mrb_str_subseq(mrb, str, beg, end-beg)); mrb_ary_push(mrb, result, mrb_str_subseq(mrb, str, beg, end-beg));
mrb_gc_arena_restore(mrb, ai); mrb_gc_arena_restore(mrb, ai);
skip = 1; skip = TRUE;
beg = ptr - bptr; beg = ptr - bptr;
if (lim_p) ++i; if (lim_p) ++i;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment