diff options
author | Kinsey Moore <kmoore@digium.com> | 2013-08-02 14:08:34 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2013-08-02 14:08:34 +0000 |
commit | 41d6be2432a77cf9da5dbb3f0590a74340a2c54e (patch) | |
tree | 50fe2992b81e196c5efc84d71fdd00a90ebf8a01 /main/astobj2.c | |
parent | f8622e7c5cbdda91a5efad230a9e3af593378c7c (diff) |
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
Diffstat (limited to 'main/astobj2.c')
-rw-r--r-- | main/astobj2.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/main/astobj2.c b/main/astobj2.c index 5bfba4e68..bbe77859d 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -5797,40 +5797,3 @@ int astobj2_init(void) return 0; } -/* 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 - */ -static int str_hash(const void *obj, const int flags) -{ - return ast_str_hash(obj); -} - -static int str_cmp(void *lhs, void *rhs, int flags) -{ - return strcmp(lhs, rhs) ? 0 : CMP_MATCH; -} - -struct ao2_container *ast_str_container_alloc_options(enum ao2_container_opts opts, int buckets) -{ - return ao2_container_alloc_options(opts, buckets, str_hash, str_cmp); -} - -int ast_str_container_add(struct ao2_container *str_container, const char *add) -{ - RAII_VAR(char *, ao2_add, ao2_alloc(strlen(add) + 1, NULL), ao2_cleanup); - - if (!ao2_add) { - return -1; - } - - /* safe strcpy */ - strcpy(ao2_add, add); - ao2_link(str_container, ao2_add); - return 0; -} - -void ast_str_container_remove(struct ao2_container *str_container, const char *remove) -{ - ao2_find(str_container, remove, OBJ_KEY | OBJ_NODATA | OBJ_UNLINK); -} |