summaryrefslogtreecommitdiff
path: root/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-11 13:26:57 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-11 13:26:57 -0700
commit32f90258bd510d84dfe8970211ec1427e9e327dc (patch)
tree6727e0574f5c648aec927e43545617b0c5fca32e /apply.c
parentc2bfd0f9cba5e94c08dcc1033d39d7bef29be08e (diff)
parent168e63554cbd965fee4d0092e02f8170eba7481f (diff)
downloadgit-32f90258bd510d84dfe8970211ec1427e9e327dc.tar.gz
Merge branch 'rs/move-array'
Code clean-up. * rs/move-array: ls-files: don't try to prune an empty index apply: use COPY_ARRAY and MOVE_ARRAY in update_image() use MOVE_ARRAY add MOVE_ARRAY
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/apply.c b/apply.c
index 9889b47d6a..41ee63e1db 100644
--- a/apply.c
+++ b/apply.c
@@ -2809,13 +2809,10 @@ static void update_image(struct apply_state *state,
img->line_allocated = img->line;
}
if (preimage_limit != postimage->nr)
- memmove(img->line + applied_pos + postimage->nr,
- img->line + applied_pos + preimage_limit,
- (img->nr - (applied_pos + preimage_limit)) *
- sizeof(*img->line));
- memcpy(img->line + applied_pos,
- postimage->line,
- postimage->nr * sizeof(*img->line));
+ MOVE_ARRAY(img->line + applied_pos + postimage->nr,
+ img->line + applied_pos + preimage_limit,
+ img->nr - (applied_pos + preimage_limit));
+ COPY_ARRAY(img->line + applied_pos, postimage->line, postimage->nr);
if (!state->allow_overlap)
for (i = 0; i < postimage->nr; i++)
img->line[applied_pos + i].flag |= LINE_PATCHED;