safe_create_leading_directories_const(): preserve errno
[gitweb.git] / split-index.c
index 3c75d4b9ce717fa92520881ef754485d068a3a60..615f4cac05f7d381b3c31831b6fd9e8a72e1f982 100644 (file)
@@ -83,8 +83,7 @@ void move_cache_to_base_index(struct index_state *istate)
        si->base->timestamp = istate->timestamp;
        ALLOC_GROW(si->base->cache, istate->cache_nr, si->base->cache_alloc);
        si->base->cache_nr = istate->cache_nr;
-       memcpy(si->base->cache, istate->cache,
-              sizeof(*istate->cache) * istate->cache_nr);
+       COPY_ARRAY(si->base->cache, istate->cache, istate->cache_nr);
        mark_base_index_entries(si->base);
        for (i = 0; i < si->base->cache_nr; i++)
                si->base->cache[i]->ce_flags &= ~CE_UPDATE_IN_BASE;
@@ -141,8 +140,7 @@ void merge_base_index(struct index_state *istate)
        istate->cache       = NULL;
        istate->cache_alloc = 0;
        ALLOC_GROW(istate->cache, istate->cache_nr, istate->cache_alloc);
-       memcpy(istate->cache, si->base->cache,
-              sizeof(*istate->cache) * istate->cache_nr);
+       COPY_ARRAY(istate->cache, si->base->cache, istate->cache_nr);
 
        si->nr_deletions = 0;
        si->nr_replacements = 0;
@@ -189,7 +187,7 @@ void prepare_to_write_split_index(struct index_state *istate)
                /* Go through istate->cache[] and mark CE_MATCHED to
                 * entry with positive index. We'll go through
                 * base->cache[] later to delete all entries in base
-                * that are not marked eith either CE_MATCHED or
+                * that are not marked with either CE_MATCHED or
                 * CE_UPDATE_IN_BASE. If istate->cache[i] is a
                 * duplicate, deduplicate it.
                 */