[PATCH v4 01/15] decorate.c: compact table when growing
- From
Kevin Bracey <kevin@bracey.fi>
- Date
- May 16, 2013, 15:32 UTC
- Message-ID
- <1368718361-27859-2-git-send-email-kevin@bracey.fi>
- In-Reply-To
- <1368718361-27859-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.3.rc0.28.g4b02ef5