authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-08 21:55:08+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-08 21:55:08+01:00
log4590712804a0392d838a839572c722cf8640960c
treedcb2e9be13c0cfaf12d48874d2d30c0e63f926e1
parenta85a29ae4d3f646f3d5a8e11bd74e9b0fea4c988

std.ascii: Remove indexOfIgnoreCase*() in favor of findIgnoreCase*()


2 files changed, 2 insertions(+), 11 deletions(-)

lib/std/ascii.zig-9
......@@ -378,17 +378,11 @@ test endsWithIgnoreCase {
378378 try std.testing.expect(!endsWithIgnoreCase("BoB", "Bo"));
379379}
380380
381/// Deprecated in favor of `findIgnoreCase`.
382pub const indexOfIgnoreCase = findIgnoreCase;
383
384381/// Finds `needle` in `haystack`, ignoring case, starting at index 0.
385382pub fn findIgnoreCase(haystack: []const u8, needle: []const u8) ?usize {
386383 return findIgnoreCasePos(haystack, 0, needle);
387384}
388385
389/// Deprecated in favor of `findIgnoreCasePos`.
390pub const indexOfIgnoreCasePos = findIgnoreCasePos;
391
392386/// Finds `needle` in `haystack`, ignoring case, starting at `start_index`.
393387/// Uses Boyer-Moore-Horspool algorithm on large inputs; `findIgnoreCasePosLinear` on small inputs.
394388pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []const u8) ?usize {
......@@ -410,9 +404,6 @@ pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []con
410404 return null;
411405}
412406
413/// Deprecated in favor of `findIgnoreCaseLinear`.
414pub const indexOfIgnoreCasePosLinear = findIgnoreCasePosLinear;
415
416407/// Consider using `findIgnoreCasePos` instead of this, which will automatically use a
417408/// more sophisticated algorithm on larger inputs.
418409pub fn findIgnoreCasePosLinear(haystack: []const u8, start_index: usize, needle: []const u8) ?usize {
src/Package/Fetch.zig+2-2
......@@ -1151,10 +1151,10 @@ const FileType = enum {
11511151
11521152 /// Parameter is a content-disposition header value.
11531153 fn fromContentDisposition(cd_header: []const u8) ?FileType {
1154 const attach_end = ascii.indexOfIgnoreCase(cd_header, "attachment;") orelse
1154 const attach_end = ascii.findIgnoreCase(cd_header, "attachment;") orelse
11551155 return null;
11561156
1157 var value_start = ascii.indexOfIgnoreCasePos(cd_header, attach_end + 1, "filename") orelse
1157 var value_start = ascii.findIgnoreCasePos(cd_header, attach_end + 1, "filename") orelse
11581158 return null;
11591159 value_start += "filename".len;
11601160 if (cd_header[value_start] == '*') {