]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-compat-util.h
RelNotes: further fixes for 2.14.2 from the master front
[thirdparty/git.git] / git-compat-util.h
index db9c22de7693af4e905fdeb0a1766ba4469eda94..7d2c0ca75922ea1ca8c67ec798ff8ce1249c925f 100644 (file)
@@ -828,6 +828,14 @@ static inline void copy_array(void *dst, const void *src, size_t n, size_t size)
                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: