From 6ae093c721d7869eae67b2bbac4e001186acd98e Mon Sep 17 00:00:00 2001 From: Robear Selwans Date: Mon, 28 Oct 2024 12:09:16 +0300 Subject: [PATCH] Re-exposed ev_vec_pop Signed-off-by: Robear Selwans --- ev_vec.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ev_vec.h b/ev_vec.h index 9250081..3c99689 100644 --- a/ev_vec.h +++ b/ev_vec.h @@ -274,6 +274,26 @@ ev_vec_append( void **arr, u64 size); +/*! + * \brief A function that copies the value at the end of a vector and removes + * it from the vector. If a copy function was passed while initializing the + * vector, then this function is used. Otherwise, memcpy is used with a length + * of `vec_meta.elemsize` + * + * \param v Reference to the vector object + * \param out A pointer to the memory block at which the popped element will be + * copied. If NULL is passed, then the element is destructed. Otherwise, the + * element is copied to `out` and the receiving code is responsible for its + * destruction. + * + * \returns An error code. If the operation was successful, then `VEC_ERR_NONE` + * is returned. + */ +EV_VEC_API ev_vec_error_t +ev_vec_pop( + ev_vec_t *v, + void *out); + /*! * \brief A function that returns the last element in the vector. *