diff --git a/src/collections/slice.c b/src/collections/slice.c index 7cfe786f1..049721a8a 100644 --- a/src/collections/slice.c +++ b/src/collections/slice.c @@ -111,10 +111,7 @@ z_result_t _z_slice_n_copy(_z_slice_t *dst, const _z_slice_t *src, size_t offset } void _z_slice_move(_z_slice_t *dst, _z_slice_t *src) { - dst->start = src->start; - dst->len = src->len; - dst->_delete_context = src->_delete_context; - + *dst = *src; _z_slice_reset(src); } diff --git a/src/collections/string.c b/src/collections/string.c index a2545e767..d15d1438e 100644 --- a/src/collections/string.c +++ b/src/collections/string.c @@ -71,7 +71,7 @@ z_result_t _z_string_copy_substring(_z_string_t *dst, const _z_string_t *src, si return _z_slice_n_copy(&dst->_slice, &src->_slice, offset, len); } -void _z_string_move(_z_string_t *dst, _z_string_t *src) { *dst = _z_string_steal(src); } +void _z_string_move(_z_string_t *dst, _z_string_t *src) { _z_slice_move(&dst->_slice, &src->_slice); } _z_string_t _z_string_steal(_z_string_t *str) { _z_string_t ret;