From d54717c39e62f4cc8b290ac4836c4d4469d87c24 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Fri, 1 Jun 2012 16:33:25 +0000 Subject: Add new config-parsing framework This framework adds a way to register the various options in a config file with Asterisk and to handle loading and reloading of that config in a consistent and atomic manner. Review: https://reviewboard.asterisk.org/r/1873/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368181 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/astobj2.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'main/astobj2.c') diff --git a/main/astobj2.c b/main/astobj2.c index 0dd07103c..4c82ea467 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -638,6 +638,7 @@ void __ao2_global_obj_release(struct ao2_global_obj *holder, const char *tag, co { if (!holder) { /* For sanity */ + ast_log(LOG_ERROR, "Must be called with a global object!\n"); return; } if (__ast_rwlock_wrlock(file, line, func, &holder->lock, name)) { @@ -660,6 +661,7 @@ void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const c if (!holder) { /* For sanity */ + ast_log(LOG_ERROR, "Must be called with a global object!\n"); return NULL; } if (__ast_rwlock_wrlock(file, line, func, &holder->lock, name)) { @@ -696,8 +698,10 @@ void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const if (!holder) { /* For sanity */ + ast_log(LOG_ERROR, "Must be called with a global object!\n"); return NULL; } + if (__ast_rwlock_rdlock(file, line, func, &holder->lock, name)) { /* Could not get the read lock. */ return NULL; @@ -713,7 +717,6 @@ void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const return obj; } - /* internal callback to destroy a container. */ static void container_destruct(void *c); @@ -1519,6 +1522,20 @@ struct ao2_container *__ao2_container_clone_debug(struct ao2_container *orig, en return clone; } +void ao2_cleanup(void *obj) +{ + if (obj) { + ao2_ref(obj, -1); + } +} + +void ao2_iterator_cleanup(struct ao2_iterator *iter) +{ + if (iter) { + ao2_iterator_destroy(iter); + } +} + #ifdef AO2_DEBUG static int print_cb(void *obj, void *arg, int flag) { -- cgit v1.2.3