mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-04 01:34:39 +00:00
Fix captures not begin zeroed when haystack length is 0
This commit is contained in:
@@ -698,11 +698,11 @@ gmatch :: proc(
|
||||
first := length > 1 ? 1 : 0
|
||||
cap := captures[first]
|
||||
res = haystack[cap.byte_start:cap.byte_end]
|
||||
} else {
|
||||
captures^ = {}
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
captures^ = {}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -813,11 +813,11 @@ gfind :: proc(
|
||||
ok = true
|
||||
cap := captures[0]
|
||||
res = haystack[cap.byte_start:cap.byte_end]
|
||||
} else {
|
||||
captures^ = {}
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
captures^ = {}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user