diff --git a/src/util/u_dynarray.h b/src/util/u_dynarray.h index 6f91b820892..b41b0d4b032 100644 --- a/src/util/u_dynarray.h +++ b/src/util/u_dynarray.h @@ -168,6 +168,16 @@ util_dynarray_trim(struct util_dynarray *buf) } } +static inline void +util_dynarray_append_dynarray(struct util_dynarray *buf, + const struct util_dynarray *other) +{ + if (other->size > 0) { + void *p = util_dynarray_grow_bytes(buf, 1, other->size); + memcpy(p, other->data, other->size); + } +} + #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) /* 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))