From 41d6be2432a77cf9da5dbb3f0590a74340a2c54e Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Fri, 2 Aug 2013 14:08:34 +0000 Subject: Move ast_str_container_alloc and friends This moves ast_str_container_alloc, ast_str_container_add, ast_str_container_remove, and related private functions into strings.c/h since they really don't belong in astobj2.c/h. As a result of this move, utils also had to be updated. Review: https://reviewboard.asterisk.org/r/2719/ (closes issue ASTERISK-22041) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396105 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/astobj2.h | 50 ---------------------------------------------- include/asterisk/strings.h | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 50 deletions(-) (limited to 'include') diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h index 495733a6d..b43c5ee94 100644 --- a/include/asterisk/astobj2.h +++ b/include/asterisk/astobj2.h @@ -1938,54 +1938,4 @@ void __ao2_cleanup_debug(void *obj, const char *file, int line, const char *func #endif void ao2_iterator_cleanup(struct ao2_iterator *iter); - -/* XXX TODO BUGBUG and all the other things... - * These functions should eventually be moved elsewhere, but the utils folder - * won't compile with them in strings.h - */ - -/*! - * \since 12 - * \brief Allocates a hash container for bare strings - * - * \param buckets The number of buckets to use for the hash container - * - * \retval AO2 container for strings - * \retval NULL if allocation failed - */ -#define ast_str_container_alloc(buckets) ast_str_container_alloc_options(AO2_ALLOC_OPT_LOCK_MUTEX, buckets) - -/*! - * \since 12 - * \brief Allocates a hash container for bare strings - * - * \param opts Options to be provided to the container - * \param buckets The number of buckets to use for the hash container - * - * \retval AO2 container for strings - * \retval NULL if allocation failed - */ -struct ao2_container *ast_str_container_alloc_options(enum ao2_container_opts opts, int buckets); - -/*! - * \since 12 - * \brief Adds a string to a string container allocated by ast_str_container_alloc - * - * \param str_container The container to which to add a string - * \param add The string to add to the container - * - * \retval zero on success - * \retval non-zero if the operation failed - */ -int ast_str_container_add(struct ao2_container *str_container, const char *add); - -/*! - * \since 12 - * \brief Removes a string from a string container allocated by ast_str_container_alloc - * - * \param str_container The container from which to remove a string - * \param remove The string to remove from the container - */ -void ast_str_container_remove(struct ao2_container *str_container, const char *remove); - #endif /* _ASTERISK_ASTOBJ2_H */ diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index 30d2503d8..fc92d4889 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -29,6 +29,7 @@ #include "asterisk/utils.h" #include "asterisk/threadstorage.h" +#include "asterisk/astobj2.h" #if defined(DEBUG_OPAQUE) #define __AST_STR_USED used2 @@ -1109,4 +1110,48 @@ static force_inline char *attribute_pure ast_str_to_upper(char *str) return str_orig; } +/*! + * \since 12 + * \brief Allocates a hash container for bare strings + * + * \param buckets The number of buckets to use for the hash container + * + * \retval AO2 container for strings + * \retval NULL if allocation failed + */ +#define ast_str_container_alloc(buckets) ast_str_container_alloc_options(AO2_ALLOC_OPT_LOCK_MUTEX, buckets) + +/*! + * \since 12 + * \brief Allocates a hash container for bare strings + * + * \param opts Options to be provided to the container + * \param buckets The number of buckets to use for the hash container + * + * \retval AO2 container for strings + * \retval NULL if allocation failed + */ +struct ao2_container *ast_str_container_alloc_options(enum ao2_container_opts opts, int buckets); + +/*! + * \since 12 + * \brief Adds a string to a string container allocated by ast_str_container_alloc + * + * \param str_container The container to which to add a string + * \param add The string to add to the container + * + * \retval zero on success + * \retval non-zero if the operation failed + */ +int ast_str_container_add(struct ao2_container *str_container, const char *add); + +/*! + * \since 12 + * \brief Removes a string from a string container allocated by ast_str_container_alloc + * + * \param str_container The container from which to remove a string + * \param remove The string to remove from the container + */ +void ast_str_container_remove(struct ao2_container *str_container, const char *remove); + #endif /* _ASTERISK_STRINGS_H */ -- cgit v1.2.3