stasis: Fix ABI between DEVMODE and non-DEVMODE.
authorCorey Farrell <git@cfware.com>
Wed, 26 Dec 2018 17:49:57 +0000 (12:49 -0500)
committerCorey Farrell <git@cfware.com>
Wed, 26 Dec 2018 18:36:13 +0000 (13:36 -0500)
Eliminate differences with DEVMODE prototypes for public functions.

ASTERISK-28212 #close

Change-Id: I872c04842ab6b61e9dd6d37e4166bc619aa20626

include/asterisk/stasis.h
include/asterisk/stasis_internal.h
include/asterisk/stasis_message_router.h
main/stasis.c
main/stasis_cache.c
main/stasis_message_router.c

index 2e274a6..09db9ea 100644 (file)
@@ -604,14 +604,9 @@ void stasis_subscription_cb_noop(void *data, struct stasis_subscription *sub, st
  * has been subscribed. This occurs immediately before accepted message
  * types can be set and the callback must expect to receive it.
  */
-#ifdef AST_DEVMODE
 struct stasis_subscription *__stasis_subscribe(struct stasis_topic *topic,
        stasis_subscription_cb callback, void *data, const char *file, int lineno, const char *func);
 #define stasis_subscribe(topic, callback, data) __stasis_subscribe(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
-struct stasis_subscription *stasis_subscribe(struct stasis_topic *topic,
-       stasis_subscription_cb callback, void *data);
-#endif
 
 /*!
  * \brief Create a subscription whose callbacks occur on a thread pool
@@ -639,14 +634,9 @@ struct stasis_subscription *stasis_subscribe(struct stasis_topic *topic,
  * has been subscribed. This occurs immediately before accepted message
  * types can be set and the callback must expect to receive it.
  */
-#ifdef AST_DEVMODE
 struct stasis_subscription *__stasis_subscribe_pool(struct stasis_topic *topic,
        stasis_subscription_cb callback, void *data, const char *file, int lineno, const char *func);
 #define stasis_subscribe_pool(topic, callback, data) __stasis_subscribe_pool(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
-struct stasis_subscription *stasis_subscribe_pool(struct stasis_topic *topic,
-       stasis_subscription_cb callback, void *data);
-#endif
 
 /*!
  * \brief Indicate to a subscription that we are interested in a message type.
index c9df032..b3e56f1 100644 (file)
@@ -60,7 +60,6 @@
  * \return \c NULL on error.
  * \since 12
  */
-#ifdef AST_DEVMODE
 struct stasis_subscription *internal_stasis_subscribe(
        struct stasis_topic *topic,
        stasis_subscription_cb callback,
@@ -70,13 +69,5 @@ struct stasis_subscription *internal_stasis_subscribe(
        const char *file,
        int lineno,
        const char *func);
-#else
-struct stasis_subscription *internal_stasis_subscribe(
-       struct stasis_topic *topic,
-       stasis_subscription_cb callback,
-       void *data,
-       int needs_mailbox,
-       int use_thread_pool);
-#endif
 
 #endif /* STASIS_INTERNAL_H_ */
index 93a2140..649eef1 100644 (file)
@@ -55,14 +55,9 @@ struct stasis_message_router;
  *
  * \since 12
  */
-#ifdef AST_DEVMODE
 struct stasis_message_router *__stasis_message_router_create(
        struct stasis_topic *topic, const char *file, int lineno, const char *func);
 #define stasis_message_router_create(topic) __stasis_message_router_create(topic, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
-struct stasis_message_router *stasis_message_router_create(
-       struct stasis_topic *topic);
-#endif
 
 /*!
  * \brief Create a new message router object.
@@ -77,14 +72,9 @@ struct stasis_message_router *stasis_message_router_create(
  *
  * \since 12.8.0
  */
-#ifdef AST_DEVMODE
 struct stasis_message_router *__stasis_message_router_create_pool(
        struct stasis_topic *topic, const char *file, int lineno, const char *func);
 #define stasis_message_router_create_pool(topic) __stasis_message_router_create_pool(topic, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
-struct stasis_message_router *stasis_message_router_create_pool(
-       struct stasis_topic *topic);
-#endif
 
 /*!
  * \brief Unsubscribe the router from the upstream topic.
index 3216e21..88cce35 100644 (file)
@@ -436,10 +436,11 @@ struct stasis_topic *stasis_topic_create(const char *name)
        res |= AST_VECTOR_INIT(&topic->upstream_topics, 0);
 #ifdef AST_DEVMODE
        topic->statistics = stasis_topic_statistics_create(name);
-       if (!topic->name || !topic->statistics || res) {
+       if (!topic->name || !topic->statistics || res)
 #else
-       if (!topic->name || res) {
+       if (!topic->name || res)
 #endif
+       {
                ao2_ref(topic, -1);
                return NULL;
        }
@@ -640,7 +641,6 @@ static struct stasis_subscription_statistics *stasis_subscription_statistics_cre
 }
 #endif
 
-#ifdef AST_DEVMODE
 struct stasis_subscription *internal_stasis_subscribe(
        struct stasis_topic *topic,
        stasis_subscription_cb callback,
@@ -650,14 +650,6 @@ struct stasis_subscription *internal_stasis_subscribe(
        const char *file,
        int lineno,
        const char *func)
-#else
-struct stasis_subscription *internal_stasis_subscribe(
-       struct stasis_topic *topic,
-       stasis_subscription_cb callback,
-       void *data,
-       int needs_mailbox,
-       int use_thread_pool)
-#endif
 {
        struct stasis_subscription *sub;
 
@@ -728,7 +720,6 @@ struct stasis_subscription *internal_stasis_subscribe(
        return sub;
 }
 
-#ifdef AST_DEVMODE
 struct stasis_subscription *__stasis_subscribe(
        struct stasis_topic *topic,
        stasis_subscription_cb callback,
@@ -739,17 +730,7 @@ struct stasis_subscription *__stasis_subscribe(
 {
        return internal_stasis_subscribe(topic, callback, data, 1, 0, file, lineno, func);
 }
-#else
-struct stasis_subscription *stasis_subscribe(
-       struct stasis_topic *topic,
-       stasis_subscription_cb callback,
-       void *data)
-{
-       return internal_stasis_subscribe(topic, callback, data, 1, 0);
-}
-#endif
 
-#ifdef AST_DEVMODE
 struct stasis_subscription *__stasis_subscribe_pool(
        struct stasis_topic *topic,
        stasis_subscription_cb callback,
@@ -760,15 +741,6 @@ struct stasis_subscription *__stasis_subscribe_pool(
 {
        return internal_stasis_subscribe(topic, callback, data, 1, 1, file, lineno, func);
 }
-#else
-struct stasis_subscription *stasis_subscribe_pool(
-       struct stasis_topic *topic,
-       stasis_subscription_cb callback,
-       void *data)
-{
-       return internal_stasis_subscribe(topic, callback, data, 1, 1);
-}
-#endif
 
 static int sub_cleanup(void *data)
 {
index 73a469e..ee8a1dd 100644 (file)
@@ -984,11 +984,7 @@ struct stasis_caching_topic *stasis_caching_topic_create(struct stasis_topic *or
        }
        ast_free(new_name);
 
-#ifdef AST_DEVMODE
        caching_topic->sub = internal_stasis_subscribe(original_topic, caching_topic_exec, caching_topic, 0, 0, __FILE__, __LINE__, __PRETTY_FUNCTION__);
-#else
-       caching_topic->sub = internal_stasis_subscribe(original_topic, caching_topic_exec, caching_topic, 0, 0);
-#endif
        if (caching_topic->sub == NULL) {
                ao2_ref(caching_topic, -1);
 
index 9a390ef..3d1a1a0 100644 (file)
@@ -204,14 +204,9 @@ static void router_dispatch(void *data,
        }
 }
 
-#ifdef AST_DEVMODE
 static struct stasis_message_router *stasis_message_router_create_internal(
        struct stasis_topic *topic, int use_thread_pool, const char *file, int lineno,
        const char *func)
-#else
-static struct stasis_message_router *stasis_message_router_create_internal(
-       struct stasis_topic *topic, int use_thread_pool)
-#endif
 {
        int res;
        struct stasis_message_router *router;
@@ -230,19 +225,11 @@ static struct stasis_message_router *stasis_message_router_create_internal(
                return NULL;
        }
 
-#ifdef AST_DEVMODE
        if (use_thread_pool) {
                router->subscription = __stasis_subscribe_pool(topic, router_dispatch, router, file, lineno, func);
        } else {
                router->subscription = __stasis_subscribe(topic, router_dispatch, router, file, lineno, func);
        }
-#else
-       if (use_thread_pool) {
-               router->subscription = stasis_subscribe_pool(topic, router_dispatch, router);
-       } else {
-               router->subscription = stasis_subscribe(topic, router_dispatch, router);
-       }
-#endif
 
        if (!router->subscription) {
                ao2_ref(router, -1);
@@ -256,33 +243,17 @@ static struct stasis_message_router *stasis_message_router_create_internal(
        return router;
 }
 
-#ifdef AST_DEVMODE
 struct stasis_message_router *__stasis_message_router_create(
        struct stasis_topic *topic, const char *file, int lineno, const char *func)
 {
        return stasis_message_router_create_internal(topic, 0, file, lineno, func);
 }
-#else
-struct stasis_message_router *stasis_message_router_create(
-       struct stasis_topic *topic)
-{
-       return stasis_message_router_create_internal(topic, 0);
-}
-#endif
 
-#ifdef AST_DEVMODE
 struct stasis_message_router *__stasis_message_router_create_pool(
        struct stasis_topic *topic, const char *file, int lineno, const char *func)
 {
        return stasis_message_router_create_internal(topic, 1, file, lineno, func);
 }
-#else
-struct stasis_message_router *stasis_message_router_create_pool(
-       struct stasis_topic *topic)
-{
-       return stasis_message_router_create_internal(topic, 1);
-}
-#endif
 
 void stasis_message_router_unsubscribe(struct stasis_message_router *router)
 {