Revision f900c8326a43303685c46b279b9f70411bff1a4b authored by Junio C Hamano on 15 December 2015, 17:47:11 UTC, committed by Junio C Hamano on 15 December 2015, 17:47:11 UTC
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent bdb32a8
strcasestr.c
#include "../git-compat-util.h"
char *gitstrcasestr(const char *haystack, const char *needle)
{
int nlen = strlen(needle);
int hlen = strlen(haystack) - nlen + 1;
int i;
for (i = 0; i < hlen; i++) {
int j;
for (j = 0; j < nlen; j++) {
unsigned char c1 = haystack[i+j];
unsigned char c2 = needle[j];
if (toupper(c1) != toupper(c2))
goto next;
}
return (char *) haystack + i;
next:
;
}
return NULL;
}
Computing file changes ...