diff options
Diffstat (limited to 'split-index.c')
-rw-r--r-- | split-index.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/split-index.c b/split-index.c index c0e8ad670d..8e52e891c3 100644 --- a/split-index.c +++ b/split-index.c @@ -5,7 +5,7 @@ struct split_index *init_split_index(struct index_state *istate) { if (!istate->split_index) { - istate->split_index = xcalloc(1, sizeof(*istate->split_index)); + CALLOC_ARRAY(istate->split_index, 1); istate->split_index->refcount = 1; } return istate->split_index; @@ -21,7 +21,7 @@ int read_link_extension(struct index_state *istate, if (sz < the_hash_algo->rawsz) return error("corrupt link extension (too short)"); si = init_split_index(istate); - hashcpy(si->base_oid.hash, data); + oidread(&si->base_oid, data); data += the_hash_algo->rawsz; sz -= the_hash_algo->rawsz; if (!sz) @@ -87,7 +87,7 @@ void move_cache_to_base_index(struct index_state *istate) mem_pool_combine(istate->ce_mem_pool, istate->split_index->base->ce_mem_pool); } - si->base = xcalloc(1, sizeof(*si->base)); + CALLOC_ARRAY(si->base, 1); si->base->version = istate->version; /* zero timestamp disables racy test in ce_write_index() */ si->base->timestamp = istate->timestamp; @@ -207,7 +207,8 @@ static int compare_ce_content(struct cache_entry *a, struct cache_entry *b) b->ce_flags &= ondisk_flags; ret = memcmp(&a->ce_stat_data, &b->ce_stat_data, offsetof(struct cache_entry, name) - - offsetof(struct cache_entry, ce_stat_data)); + offsetof(struct cache_entry, oid)) || + !oideq(&a->oid, &b->oid); a->ce_flags = ce_flags; b->ce_flags = base_flags; |