git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] diff-delta.c: Fix broken skip calculation.

From
David Kastrup <dak@gnu.org>
Date
Aug 23, 2007, 05:51 UTC
Message-ID
<85veb6iyry.fsf@lola.goethe.zz>
In-Reply-To
<alpine.LFD.0.999.0708222126590.16727@xanadu.home>

A particularly bad case was HASH_LIMIT <= hash_count[i] < 2*HASH_LIMIT: in that case, only a single hash survived. For larger cases, 2*HASH_LIMIT was the actual limiting value after pruning.

Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Kastrup <dak@gnu.org>
---
 diff-delta.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/diff-delta.c b/diff-delta.c
index 3af5835..0dde2f2 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -213,7 +213,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
 		entry = hash[i];
 		do {
 			struct index_entry *keep = entry;
-			int skip = hash_count[i] / HASH_LIMIT / 2;
+			int skip = hash_count[i] / HASH_LIMIT;
 			do {
 				entry = entry->next;
 			} while(--skip && entry);
-- 
1.5.3.rc2.257.gd8a21
Previous: Nicolas PitreNext: Junio C Hamano
Message 3 of 4 in “Strange code in diff-delta.c”
  1. David KastrupAug 23, 2007
  2. Nicolas PitreAug 23, 2007
  3. diff-delta.c: Fix broken skip calculation.David Kastrup, Aug 23, 2007
  4. Junio C HamanoAug 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.