aboutsummaryrefslogtreecommitdiff
path: root/core/strings
diff options
context:
space:
mode:
authorJacob Friedman <jacobjf01@gmail.com>2025-02-04 19:51:48 +0100
committerJacob Friedman <jacobjf01@gmail.com>2025-02-04 19:51:48 +0100
commit385f5f50147f6f68f7722befc5ce0d36751a034d (patch)
treedd35bff5377c96600f64f875f59c2eb085b11cd4 /core/strings
parent4c0b145bad3a49d3110ddc18c0dae2e59dcf05e4 (diff)
Small optimization
Diffstat (limited to 'core/strings')
-rw-r--r--core/strings/strings.odin4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin
index b050262f0..e99a1bfb4 100644
--- a/core/strings/strings.odin
+++ b/core/strings/strings.odin
@@ -1031,7 +1031,7 @@ Returns:
*/
@private
_split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string, ok: bool) {
- m := index(s^, sep)
+ m: int
if sep == "" {
if len(s) == 0 {
m = -1
@@ -1039,6 +1039,8 @@ _split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string,
_, w := utf8.decode_rune_in_string(s^)
m = w
}
+ } else {
+ m = index(s^, sep)
}
if m < 0 {
// not found