From a8b2f453463bb2a2be8afec7ca3c99f60fb07df7 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 13 Dec 2024 15:49:35 -0500 Subject: [PATCH] util/dynarray: Add macro for appending an array Part-of: --- src/util/u_dynarray.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/u_dynarray.h b/src/util/u_dynarray.h index 31a7756e9a9..4f1092c2848 100644 --- a/src/util/u_dynarray.h +++ b/src/util/u_dynarray.h @@ -200,6 +200,7 @@ util_dynarray_append_dynarray(struct util_dynarray *buf, } #define util_dynarray_append(buf, type, v) do {type __v = (v); memcpy(util_dynarray_grow_bytes((buf), 1, sizeof(type)), &__v, sizeof(type));} while(0) +#define util_dynarray_append_array(buf, type, v, count) do {memcpy(util_dynarray_grow_bytes((buf), count, sizeof(type)), v, sizeof(type) * count);} while(0) /* Returns a pointer to the space of the first new element (in case of growth) or NULL on failure. */ #define util_dynarray_resize(buf, type, nelts) util_dynarray_resize_bytes(buf, (nelts), sizeof(type)) #define util_dynarray_grow(buf, type, ngrow) util_dynarray_grow_bytes(buf, (ngrow), sizeof(type))