[PATCH v2 1/8] decorate.c: compact table when growing
- From
Kevin Bracey <kevin@bracey.fi>
- Date
- Apr 30, 2013, 17:26 UTC
- Message-ID
- <1367342788-7795-2-git-send-email-kevin@bracey.fi>
- In-Reply-To
- <1367342788-7795-1-git-send-email-kevin@bracey.fi>
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> --- decorate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/decorate.c b/decorate.c index 2f8a63e..7cb5d29 100644 --- a/decorate.c +++ b/decorate.c @@ -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); }
-- 1.8.2.1.632.gd2b1879