summaryrefslogtreecommitdiff
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-06-01 16:33:25 +0000
committerTerry Wilson <twilson@digium.com>2012-06-01 16:33:25 +0000
commitd54717c39e62f4cc8b290ac4836c4d4469d87c24 (patch)
tree5a765e82be880f3b8c2407133fbcc15c4b4349d0 /main/astobj2.c
parent463f9d729aed1a5ed538aa3deed1a3fed9462111 (diff)
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
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c19
1 files changed, 18 insertions, 1 deletions
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)
{