Skip to content

Commit

Permalink
decorate.c: compact table when growing
Browse files Browse the repository at this point in the history
When growing the table, take the opportunity to "compact" it by removing
entries with NULL decoration.

Users may have "removed" decorations by passing NULL to
insert_decoration. An object's table entry can't actually be removed
during normal operation, as it would break the linear hash collision
search. But we can remove NULL decoration entries when rebuilding the
table.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Kevin Bracey authored and Junio C Hamano committed May 16, 2013
1 parent a765499 commit 83f0412
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion decorate.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void grow_decoration(struct decoration *n)
const struct object *base = old_hash[i].base;
void *decoration = old_hash[i].decoration;

if (!base)
if (!decoration)
continue;
insert_decoration(n, base, decoration);
}
Expand Down

0 comments on commit 83f0412

Please sign in to comment.