Staging
v0.5.2
v0.5.2
Revision 3ffb58be0a779b47e1e4d3ea584ba301461a3a77 authored by Jeff King on 24 April 2008, 01:28:36 UTC, committed by Junio C Hamano on 25 April 2008, 04:50:19 UTC
It seems to be a FAQ that people try running git-gc, and then get puzzled about why the size of their .git directory didn't change. This note mentions the reasons why things might unexpectedly get kept. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d6958a1
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 ...