sorcery, bucket: Change observer remove calls to take const callbacks struct.

* Make ast_sorcery_observer_remove() accept a const callbacks struct.

* Make ast_sorcery_observer_remove() tolerant of the sorcery parameter
being NULL.  Now it can be called within a module unload routine if the
sorcery initialization fails.

* Fix ast_sorcery_observer_add() to fail if the container link fails.
........

Merged revisions 403324 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2013-12-03 17:35:54 +00:00
parent 8e8b329e14
commit 3357c494cb
8 changed files with 26 additions and 15 deletions

View File

@@ -256,7 +256,7 @@ int ast_bucket_observer_add(const struct ast_sorcery_observer *callbacks);
*
* \param callbacks Implementation of the sorcery observer interface
*/
void ast_bucket_observer_remove(struct ast_sorcery_observer *callbacks);
void ast_bucket_observer_remove(const struct ast_sorcery_observer *callbacks);
/*!
* \brief Get a JSON representation of a bucket
@@ -359,7 +359,7 @@ int ast_bucket_file_observer_add(const struct ast_sorcery_observer *callbacks);
*
* \param callbacks Implementation of the sorcery observer interface
*/
void ast_bucket_file_observer_remove(struct ast_sorcery_observer *callbacks);
void ast_bucket_file_observer_remove(const struct ast_sorcery_observer *callbacks);
/*!
* \brief Get a JSON representation of a bucket file

View File

@@ -349,6 +349,7 @@ int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, c
* \param sorcery Pointer to a sorcery structure
* \param type Type of object
* \param hidden All objects of this type are internal and should not be manipulated by users
* \param reloadable All objects of this type are reloadable
* \param alloc Required object allocation callback
* \param transform Optional transformation callback
* \param apply Optional object set apply callback
@@ -689,7 +690,7 @@ int ast_sorcery_observer_add(const struct ast_sorcery *sorcery, const char *type
* \retval 0 success
* \retval -1 failure
*/
void ast_sorcery_observer_remove(const struct ast_sorcery *sorcery, const char *type, struct ast_sorcery_observer *callbacks);
void ast_sorcery_observer_remove(const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks);
/*!
* \brief Create and potentially persist an object using an available wizard
@@ -720,7 +721,7 @@ void *ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *
* \param sorcery Pointer to a sorcery structure
* \param type Type of object to retrieve
* \param flags Flags to control behavior
* \param fields Optional jbject fields and values to match against
* \param fields Optional object fields and values to match against
*
* \retval non-NULL if found
* \retval NULL if not found