diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-02-14 11:01:34 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2022-02-14 11:01:34 +0000 |
| commit | 2e7157ae9cd0eb38133a750e7f4845661d8751ba (patch) | |
| tree | 76265366de9968641a3c7121ea4d8179467b831c /core/bytes | |
| parent | 441365b3886967465da4f9201e8dfdfc059931e4 (diff) | |
Correct bytes._split_iterator
Diffstat (limited to 'core/bytes')
| -rw-r--r-- | core/bytes/bytes.odin | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/bytes/bytes.odin b/core/bytes/bytes.odin index fb36b2d6e..09a3ed259 100644 --- a/core/bytes/bytes.odin +++ b/core/bytes/bytes.odin @@ -218,8 +218,8 @@ split_after_n :: proc(s, sep: []byte, n: int, allocator := context.allocator) -> @private -_split_iterator :: proc(s: ^[]byte, sep: []byte, sep_save, n: int) -> (res: []byte, ok: bool) { - if sep == "" { +_split_iterator :: proc(s: ^[]byte, sep: []byte, sep_save: int) -> (res: []byte, ok: bool) { + if len(sep) == 0 { res = s[:] ok = true s^ = s[len(s):] @@ -230,7 +230,7 @@ _split_iterator :: proc(s: ^[]byte, sep: []byte, sep_save, n: int) -> (res: []by if m < 0 { // not found res = s[:] - ok = res != "" + ok = len(res) != 0 s^ = s[len(s):] } else { res = s[:m+sep_save] @@ -242,11 +242,11 @@ _split_iterator :: proc(s: ^[]byte, sep: []byte, sep_save, n: int) -> (res: []by split_iterator :: proc(s: ^[]byte, sep: []byte) -> ([]byte, bool) { - return _split_iterator(s, sep, 0, -1) + return _split_iterator(s, sep, 0) } split_after_iterator :: proc(s: ^[]byte, sep: []byte) -> ([]byte, bool) { - return _split_iterator(s, sep, len(sep), -1) + return _split_iterator(s, sep, len(sep)) } |