Browse Source

decorate.c: compact table when growing

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>
maint
Kevin Bracey 12 years ago committed by Junio C Hamano
parent
commit
83f0412f3f
  1. 2
      decorate.c

2
decorate.c

@ -49,7 +49,7 @@ static void grow_decoration(struct decoration *n)
const struct object *base = old_hash[i].base; const struct object *base = old_hash[i].base;
void *decoration = old_hash[i].decoration; void *decoration = old_hash[i].decoration;


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

Loading…
Cancel
Save