From f98ca92c0f9b2a534409f45f49ffe2df1710a13a Mon Sep 17 00:00:00 2001 From: Jean-Roland Gosse Date: Tue, 10 Dec 2024 16:51:09 +0100 Subject: [PATCH] fix: svec copy init (#826) --- src/collections/vec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/collections/vec.c b/src/collections/vec.c index c03f18f09..733267e5b 100644 --- a/src/collections/vec.c +++ b/src/collections/vec.c @@ -171,8 +171,7 @@ void _z_svec_move(_z_svec_t *dst, _z_svec_t *src) { z_result_t _z_svec_copy(_z_svec_t *dst, const _z_svec_t *src, z_element_copy_f copy, size_t element_size, bool use_elem_f) { - dst->_capacity = 0; - dst->_len = 0; + *dst = _z_svec_null(); dst->_val = z_malloc(element_size * src->_capacity); if (dst->_val == NULL) { return _Z_ERR_SYSTEM_OUT_OF_MEMORY;