From: Junio C Hamano Date: Wed, 23 Aug 2017 21:33:46 +0000 (-0700) Subject: Merge branch 'rs/move-array' into maint X-Git-Tag: v2.14.2~54 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d3b7ee087e3ed409b943d62501bd7fb8dbd96dd8?hp=-c Merge branch 'rs/move-array' into maint 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 --- d3b7ee087e3ed409b943d62501bd7fb8dbd96dd8 diff --combined git-compat-util.h index db9c22de76,159f82154a..7d2c0ca759 --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -189,9 -189,6 +189,9 @@@ #include #endif +#if defined(__CYGWIN__) +#include "compat/cygwin.h" +#endif #if defined(__MINGW32__) /* pull in Windows compatibility stuff */ #include "compat/mingw.h" @@@ -828,6 -825,14 +828,14 @@@ static inline void copy_array(void *dst memcpy(dst, src, st_mult(size, n)); } + #define MOVE_ARRAY(dst, src, n) move_array((dst), (src), (n), sizeof(*(dst)) + \ + BUILD_ASSERT_OR_ZERO(sizeof(*(dst)) == sizeof(*(src)))) + static inline void move_array(void *dst, const void *src, size_t n, size_t size) + { + if (n) + memmove(dst, src, st_mult(size, n)); + } + /* * These functions help you allocate structs with flex arrays, and copy * the data directly into the array. For example, if you had: