Revision df487baa30924a36ade38ada4f77379236dcce0f authored by Junio C Hamano on 09 February 2009, 06:07:53 UTC, committed by Junio C Hamano on 09 February 2009, 06:07:53 UTC
* maint: gitweb: add $prevent_xss option to prevent XSS by repository content rev-list: fix showing distance when using --bisect-all
memmem.c
#include "../git-compat-util.h"
void *gitmemmem(const void *haystack, size_t haystack_len,
const void *needle, size_t needle_len)
{
const char *begin = haystack;
const char *last_possible = begin + haystack_len - needle_len;
/*
* The first occurrence of the empty string is deemed to occur at
* the beginning of the string.
*/
if (needle_len == 0)
return (void *)begin;
/*
* Sanity check, otherwise the loop might search through the whole
* memory.
*/
if (haystack_len < needle_len)
return NULL;
for (; begin <= last_possible; begin++) {
if (!memcmp(begin, needle, needle_len))
return (void *)begin;
}
return NULL;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...