Fix captures not begin zeroed when haystack length is 0

This commit is contained in:
James Duran
2025-01-15 15:56:40 -08:00
parent a7971f9f6f
commit 13640620ce

View File

@@ -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
}