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
This commit is contained in:
@ -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:
|
||||
|
Reference in New Issue
Block a user