diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/alertpipe.h | 3 | ||||
-rw-r--r-- | include/asterisk/vector.h | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/include/asterisk/alertpipe.h b/include/asterisk/alertpipe.h index 5ff854ce8..09c335829 100644 --- a/include/asterisk/alertpipe.h +++ b/include/asterisk/alertpipe.h @@ -65,7 +65,8 @@ ast_alert_status_t ast_alertpipe_read(int alert_pipe[2]); * * \param p a two-element array containing the alert pipe's file descriptors * - * \return see write(2) + * \retval 0 Success + * \retval 1 Failure */ ssize_t ast_alertpipe_write(int alert_pipe[2]); diff --git a/include/asterisk/vector.h b/include/asterisk/vector.h index 8270e25a9..2ee5e29a6 100644 --- a/include/asterisk/vector.h +++ b/include/asterisk/vector.h @@ -51,6 +51,9 @@ /*! \brief Integer vector definition */ AST_VECTOR(ast_vector_int, int); +/*! \brief String vector definition */ +AST_VECTOR(ast_vector_string, char *); + /*! * \brief Define a vector structure with a read/write lock * @@ -91,6 +94,26 @@ AST_VECTOR(ast_vector_int, int); }) /*! + * \brief Steal the elements from a vector and reinitialize. + * + * \param vec Vector to operate on. + * + * This allows you to use vector.h to construct a list and use the + * data as a bare array. + * + * \note The stolen array must eventually be released using ast_free. + * + * \warning AST_VECTOR_SIZE and AST_VECTOR_MAX_SIZE are both reset + * to 0. If either are needed they must be saved to a local + * variable before stealing the elements. + */ +#define AST_VECTOR_STEAL_ELEMENTS(vec) ({ \ + typeof((vec)->elems) __elems = (vec)->elems; \ + AST_VECTOR_INIT((vec), 0); \ + (__elems); \ +}) + +/*! * \brief Initialize a vector with a read/write lock * * If \a size is 0, then no space will be allocated until the vector is |