summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-06-15 18:36:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-18 01:15:04 (GMT)
commit921d49be86bd44ca290c8db6cc6f419dac3ed442 (patch)
tree73c8ec3613227772c56732a3d7da8e67e596e625 /packfile.c
parent177fbab747da4f58cb2a8ce010b3515c86dd67c9 (diff)
downloadgit-921d49be86bd44ca290c8db6cc6f419dac3ed442.zip
git-921d49be86bd44ca290c8db6cc6f419dac3ed442.tar.gz
git-921d49be86bd44ca290c8db6cc6f419dac3ed442.tar.bz2
use COPY_ARRAY for copying arrays
Convert calls of memcpy(3) to use COPY_ARRAY, which shortens and simplifies the code a bit. Patch generated by Coccinelle and contrib/coccinelle/array.cocci. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/packfile.c b/packfile.c
index 49c8544..2ff570f 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1269,7 +1269,7 @@ static enum object_type packed_to_object_type(struct repository *r,
if (poi_stack_nr >= poi_stack_alloc && poi_stack == small_poi_stack) {
poi_stack_alloc = alloc_nr(poi_stack_nr);
ALLOC_ARRAY(poi_stack, poi_stack_alloc);
- memcpy(poi_stack, small_poi_stack, sizeof(off_t)*poi_stack_nr);
+ COPY_ARRAY(poi_stack, small_poi_stack, poi_stack_nr);
} else {
ALLOC_GROW(poi_stack, poi_stack_nr+1, poi_stack_alloc);
}
@@ -1679,8 +1679,8 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
&& delta_stack == small_delta_stack) {
delta_stack_alloc = alloc_nr(delta_stack_nr);
ALLOC_ARRAY(delta_stack, delta_stack_alloc);
- memcpy(delta_stack, small_delta_stack,
- sizeof(*delta_stack)*delta_stack_nr);
+ COPY_ARRAY(delta_stack, small_delta_stack,
+ delta_stack_nr);
} else {
ALLOC_GROW(delta_stack, delta_stack_nr+1, delta_stack_alloc);
}