mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge pull request #3882 from Kelimion/clean_up_iterator
Remove nil checks.
This commit is contained in:
@@ -1001,11 +1001,6 @@ Returns:
|
|||||||
*/
|
*/
|
||||||
@private
|
@private
|
||||||
_split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string, ok: bool) {
|
_split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string, ok: bool) {
|
||||||
// stop once the string is empty or nil
|
|
||||||
if s == nil || len(s^) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if sep == "" {
|
if sep == "" {
|
||||||
res = s[:]
|
res = s[:]
|
||||||
ok = true
|
ok = true
|
||||||
@@ -2414,9 +2409,6 @@ trim_right_proc_with_state :: proc(s: string, p: proc(rawptr, rune) -> bool, sta
|
|||||||
}
|
}
|
||||||
// Procedure for `trim_*_proc` variants, which has a string rawptr cast + rune comparison
|
// Procedure for `trim_*_proc` variants, which has a string rawptr cast + rune comparison
|
||||||
is_in_cutset :: proc(state: rawptr, r: rune) -> (res: bool) {
|
is_in_cutset :: proc(state: rawptr, r: rune) -> (res: bool) {
|
||||||
if state == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
cutset := (^string)(state)^
|
cutset := (^string)(state)^
|
||||||
for c in cutset {
|
for c in cutset {
|
||||||
if r == c {
|
if r == c {
|
||||||
@@ -2714,7 +2706,7 @@ Output:
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
split_multi_iterate :: proc(it: ^string, substrs: []string) -> (res: string, ok: bool) #no_bounds_check {
|
split_multi_iterate :: proc(it: ^string, substrs: []string) -> (res: string, ok: bool) #no_bounds_check {
|
||||||
if it == nil || len(it) == 0 || len(substrs) <= 0 {
|
if len(it) == 0 || len(substrs) <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user