diff options
author | Karsten Blees <karsten.blees@gmail.com> | 2013-11-14 20:21:58 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-11-18 13:04:24 -0800 |
commit | 8b013788a14b96b8d20b1f6bc76a42f9733aefad (patch) | |
tree | 6819f34323de1ad90c9517def56e35fc4ee32448 /cache.h | |
parent | 1c8cca190a1029d16450e61fbc4ce6f85a867f30 (diff) | |
download | git-8b013788a14b96b8d20b1f6bc76a42f9733aefad.tar.gz |
name-hash.c: use new hash map implementation for cache entries
Note: the "ce->next = NULL;" in unpack-trees.c::do_add_entry can safely be
removed, as ce->next (now ce->ent.next) is always properly initialized in
name-hash.c::hash_index_entry.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -131,12 +131,12 @@ struct stat_data { }; struct cache_entry { + struct hashmap_entry ent; struct stat_data ce_stat_data; unsigned int ce_mode; unsigned int ce_flags; unsigned int ce_namelen; unsigned char sha1[20]; - struct cache_entry *next; char name[FLEX_ARRAY]; /* more */ }; @@ -203,7 +203,9 @@ static inline void copy_cache_entry(struct cache_entry *dst, unsigned int state = dst->ce_flags & CE_STATE_MASK; /* Don't copy hash chain and name */ - memcpy(dst, src, offsetof(struct cache_entry, next)); + memcpy(&dst->ce_stat_data, &src->ce_stat_data, + offsetof(struct cache_entry, name) - + offsetof(struct cache_entry, ce_stat_data)); /* Restore the hash state */ dst->ce_flags = (dst->ce_flags & ~CE_STATE_MASK) | state; @@ -278,7 +280,7 @@ struct index_state { struct cache_time timestamp; unsigned name_hash_initialized : 1, initialized : 1; - struct hash_table name_hash; + struct hashmap name_hash; struct hashmap dir_hash; }; |