summaryrefslogtreecommitdiff
path: root/main/stasis_cache.c
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-05-15 02:37:22 +0000
committerDavid M. Lee <dlee@digium.com>2013-05-15 02:37:22 +0000
commit9648e258c76a24c5a24e16c634fcda73829e5d30 (patch)
treea0dc5b31ee73a83a7799413929a40436a1526293 /main/stasis_cache.c
parente8f4ac6c610265b46014da9259062bb74d3892d1 (diff)
Refactored the rest of the message types to use the STASIS_MESSAGE_TYPE_*
macros. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_cache.c')
-rw-r--r--main/stasis_cache.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/main/stasis_cache.c b/main/stasis_cache.c
index 6d07dc3c5..75e6b5f95 100644
--- a/main/stasis_cache.c
+++ b/main/stasis_cache.c
@@ -240,21 +240,8 @@ struct ao2_container *stasis_cache_dump(struct stasis_caching_topic *caching_top
return cache_dump.cached;
}
-static struct stasis_message_type *cache_clear_type;
-
-struct stasis_message_type *stasis_cache_clear_type(void)
-{
- ast_assert(cache_clear_type != NULL);
- return cache_clear_type;
-}
-
-static struct stasis_message_type *cache_update_type;
-
-struct stasis_message_type *stasis_cache_update_type(void)
-{
- ast_assert(cache_update_type != NULL);
- return cache_update_type;
-}
+STASIS_MESSAGE_TYPE_DEFN(stasis_cache_clear_type);
+STASIS_MESSAGE_TYPE_DEFN(stasis_cache_update_type);
static void cache_clear_dtor(void *obj)
{
@@ -442,30 +429,22 @@ struct stasis_caching_topic *stasis_caching_topic_create(struct stasis_topic *or
static void stasis_cache_exit(void)
{
- ao2_cleanup(cache_clear_type);
- cache_clear_type = NULL;
- ao2_cleanup(cache_update_type);
- cache_update_type = NULL;
+ STASIS_MESSAGE_TYPE_CLEANUP(stasis_cache_clear_type);
+ STASIS_MESSAGE_TYPE_CLEANUP(stasis_cache_update_type);
}
int stasis_cache_init(void)
{
ast_register_atexit(stasis_cache_exit);
- if (cache_clear_type || cache_update_type) {
- ast_log(LOG_ERROR, "Stasis cache double initialized\n");
+ if (STASIS_MESSAGE_TYPE_INIT(stasis_cache_clear_type) != 0) {
return -1;
}
- cache_update_type = stasis_message_type_create("stasis_cache_update");
- if (!cache_update_type) {
+ if (STASIS_MESSAGE_TYPE_INIT(stasis_cache_update_type) != 0) {
return -1;
}
- cache_clear_type = stasis_message_type_create("StasisCacheClear");
- if (!cache_clear_type) {
- return -1;
- }
return 0;
}