summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorKarsten Blees <karsten.blees@gmail.com>2013-11-14 19:21:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-11-18 21:04:24 (GMT)
commit8b013788a14b96b8d20b1f6bc76a42f9733aefad (patch)
tree6819f34323de1ad90c9517def56e35fc4ee32448 /cache.h
parent1c8cca190a1029d16450e61fbc4ce6f85a867f30 (diff)
downloadgit-8b013788a14b96b8d20b1f6bc76a42f9733aefad.zip
git-8b013788a14b96b8d20b1f6bc76a42f9733aefad.tar.gz
git-8b013788a14b96b8d20b1f6bc76a42f9733aefad.tar.bz2
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.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/cache.h b/cache.h
index f9b13ec..85210b1 100644
--- a/cache.h
+++ b/cache.h
@@ -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;
};