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
This commit is contained in:
Terry Wilson
2012-06-01 16:33:25 +00:00
parent 463f9d729a
commit d54717c39e
17 changed files with 2430 additions and 199 deletions

View File

@@ -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)
{