<p>Friendly Automation <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10841">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua C. Colp: Looks good to me, but someone else must approve
  Matthew Fredrickson: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stasis: Fix ABI between DEVMODE and non-DEVMODE.<br><br>Create compatibility stubs for maximum ABI compatibility.<br><br>ASTERISK-28212 #close<br><br>Change-Id: I872c04842ab6b61e9dd6d37e4166bc619aa20626<br>---<br>M include/asterisk/stasis.h<br>M include/asterisk/stasis_internal.h<br>M include/asterisk/stasis_message_router.h<br>M main/stasis.c<br>M main/stasis_cache.c<br>M main/stasis_message_router.c<br>6 files changed, 55 insertions(+), 77 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/stasis.h b/include/asterisk/stasis.h</span><br><span>index 2e274a6..357f34e 100644</span><br><span>--- a/include/asterisk/stasis.h</span><br><span>+++ b/include/asterisk/stasis.h</span><br><span>@@ -604,9 +604,9 @@</span><br><span>  * has been subscribed. This occurs immediately before accepted message</span><br><span>  * types can be set and the callback must expect to receive it.</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_subscription *__stasis_subscribe(struct stasis_topic *topic,</span><br><span>  stasis_subscription_cb callback, void *data, const char *file, int lineno, const char *func);</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef AST_DEVMODE</span><br><span> #define stasis_subscribe(topic, callback, data) __stasis_subscribe(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__)</span><br><span> #else</span><br><span> struct stasis_subscription *stasis_subscribe(struct stasis_topic *topic,</span><br><span>@@ -639,9 +639,9 @@</span><br><span>  * has been subscribed. This occurs immediately before accepted message</span><br><span>  * types can be set and the callback must expect to receive it.</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_subscription *__stasis_subscribe_pool(struct stasis_topic *topic,</span><br><span>         stasis_subscription_cb callback, void *data, const char *file, int lineno, const char *func);</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef AST_DEVMODE</span><br><span> #define stasis_subscribe_pool(topic, callback, data) __stasis_subscribe_pool(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__)</span><br><span> #else</span><br><span> struct stasis_subscription *stasis_subscribe_pool(struct stasis_topic *topic,</span><br><span>diff --git a/include/asterisk/stasis_internal.h b/include/asterisk/stasis_internal.h</span><br><span>index c9df032..b3e56f1 100644</span><br><span>--- a/include/asterisk/stasis_internal.h</span><br><span>+++ b/include/asterisk/stasis_internal.h</span><br><span>@@ -60,7 +60,6 @@</span><br><span>  * \return \c NULL on error.</span><br><span>  * \since 12</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_subscription *internal_stasis_subscribe(</span><br><span>      struct stasis_topic *topic,</span><br><span>  stasis_subscription_cb callback,</span><br><span>@@ -70,13 +69,5 @@</span><br><span>        const char *file,</span><br><span>    int lineno,</span><br><span>  const char *func);</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-struct stasis_subscription *internal_stasis_subscribe(</span><br><span style="color: hsl(0, 100%, 40%);">-   struct stasis_topic *topic,</span><br><span style="color: hsl(0, 100%, 40%);">-     stasis_subscription_cb callback,</span><br><span style="color: hsl(0, 100%, 40%);">-        void *data,</span><br><span style="color: hsl(0, 100%, 40%);">-     int needs_mailbox,</span><br><span style="color: hsl(0, 100%, 40%);">-      int use_thread_pool);</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span> #endif /* STASIS_INTERNAL_H_ */</span><br><span>diff --git a/include/asterisk/stasis_message_router.h b/include/asterisk/stasis_message_router.h</span><br><span>index 93a2140..fefbea0 100644</span><br><span>--- a/include/asterisk/stasis_message_router.h</span><br><span>+++ b/include/asterisk/stasis_message_router.h</span><br><span>@@ -55,9 +55,9 @@</span><br><span>  *</span><br><span>  * \since 12</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_message_router *__stasis_message_router_create(</span><br><span>  struct stasis_topic *topic, const char *file, int lineno, const char *func);</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef AST_DEVMODE</span><br><span> #define stasis_message_router_create(topic) __stasis_message_router_create(topic, __FILE__, __LINE__, __PRETTY_FUNCTION__)</span><br><span> #else</span><br><span> struct stasis_message_router *stasis_message_router_create(</span><br><span>@@ -77,9 +77,9 @@</span><br><span>  *</span><br><span>  * \since 12.8.0</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_message_router *__stasis_message_router_create_pool(</span><br><span>  struct stasis_topic *topic, const char *file, int lineno, const char *func);</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef AST_DEVMODE</span><br><span> #define stasis_message_router_create_pool(topic) __stasis_message_router_create_pool(topic, __FILE__, __LINE__, __PRETTY_FUNCTION__)</span><br><span> #else</span><br><span> struct stasis_message_router *stasis_message_router_create_pool(</span><br><span>diff --git a/main/stasis.c b/main/stasis.c</span><br><span>index 3216e21..b743f99 100644</span><br><span>--- a/main/stasis.c</span><br><span>+++ b/main/stasis.c</span><br><span>@@ -436,10 +436,11 @@</span><br><span>       res |= AST_VECTOR_INIT(&topic->upstream_topics, 0);</span><br><span> #ifdef AST_DEVMODE</span><br><span>     topic->statistics = stasis_topic_statistics_create(name);</span><br><span style="color: hsl(0, 100%, 40%);">-    if (!topic->name || !topic->statistics || res) {</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!topic->name || !topic->statistics || res)</span><br><span> #else</span><br><span style="color: hsl(0, 100%, 40%);">-   if (!topic->name || res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!topic->name || res)</span><br><span> #endif</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span>            ao2_ref(topic, -1);</span><br><span>          return NULL;</span><br><span>         }</span><br><span>@@ -640,7 +641,6 @@</span><br><span> }</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_subscription *internal_stasis_subscribe(</span><br><span>       struct stasis_topic *topic,</span><br><span>  stasis_subscription_cb callback,</span><br><span>@@ -650,14 +650,6 @@</span><br><span>      const char *file,</span><br><span>    int lineno,</span><br><span>  const char *func)</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-struct stasis_subscription *internal_stasis_subscribe(</span><br><span style="color: hsl(0, 100%, 40%);">-    struct stasis_topic *topic,</span><br><span style="color: hsl(0, 100%, 40%);">-     stasis_subscription_cb callback,</span><br><span style="color: hsl(0, 100%, 40%);">-        void *data,</span><br><span style="color: hsl(0, 100%, 40%);">-     int needs_mailbox,</span><br><span style="color: hsl(0, 100%, 40%);">-      int use_thread_pool)</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> {</span><br><span>      struct stasis_subscription *sub;</span><br><span> </span><br><span>@@ -728,7 +720,6 @@</span><br><span>   return sub;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_subscription *__stasis_subscribe(</span><br><span>    struct stasis_topic *topic,</span><br><span>  stasis_subscription_cb callback,</span><br><span>@@ -739,17 +730,7 @@</span><br><span> {</span><br><span>         return internal_stasis_subscribe(topic, callback, data, 1, 0, file, lineno, func);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-struct stasis_subscription *stasis_subscribe(</span><br><span style="color: hsl(0, 100%, 40%);">-       struct stasis_topic *topic,</span><br><span style="color: hsl(0, 100%, 40%);">-     stasis_subscription_cb callback,</span><br><span style="color: hsl(0, 100%, 40%);">-        void *data)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-    return internal_stasis_subscribe(topic, callback, data, 1, 0);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_subscription *__stasis_subscribe_pool(</span><br><span>  struct stasis_topic *topic,</span><br><span>  stasis_subscription_cb callback,</span><br><span>@@ -760,15 +741,6 @@</span><br><span> {</span><br><span>         return internal_stasis_subscribe(topic, callback, data, 1, 1, file, lineno, func);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-struct stasis_subscription *stasis_subscribe_pool(</span><br><span style="color: hsl(0, 100%, 40%);">-  struct stasis_topic *topic,</span><br><span style="color: hsl(0, 100%, 40%);">-     stasis_subscription_cb callback,</span><br><span style="color: hsl(0, 100%, 40%);">-        void *data)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-    return internal_stasis_subscribe(topic, callback, data, 1, 1);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span> static int sub_cleanup(void *data)</span><br><span> {</span><br><span>@@ -2666,3 +2638,31 @@</span><br><span> </span><br><span>    return 0;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef AST_DEVMODE</span><br><span style="color: hsl(120, 100%, 40%);">+#undef stasis_subscribe</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_subscription *stasis_subscribe(</span><br><span style="color: hsl(120, 100%, 40%);">+  struct stasis_topic *topic,</span><br><span style="color: hsl(120, 100%, 40%);">+   stasis_subscription_cb callback,</span><br><span style="color: hsl(120, 100%, 40%);">+      void *data);</span><br><span style="color: hsl(120, 100%, 40%);">+#undef stasis_subscribe_pool</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_subscription *stasis_subscribe_pool(</span><br><span style="color: hsl(120, 100%, 40%);">+        struct stasis_topic *topic,</span><br><span style="color: hsl(120, 100%, 40%);">+   stasis_subscription_cb callback,</span><br><span style="color: hsl(120, 100%, 40%);">+      void *data);</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_subscription *stasis_subscribe(</span><br><span style="color: hsl(120, 100%, 40%);">+   struct stasis_topic *topic,</span><br><span style="color: hsl(120, 100%, 40%);">+   stasis_subscription_cb callback,</span><br><span style="color: hsl(120, 100%, 40%);">+      void *data)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        return internal_stasis_subscribe(topic, callback, data, 1, 0, __FILE__, __LINE__, __PRETTY_FUNCTION__);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_subscription *stasis_subscribe_pool(</span><br><span style="color: hsl(120, 100%, 40%);">+      struct stasis_topic *topic,</span><br><span style="color: hsl(120, 100%, 40%);">+   stasis_subscription_cb callback,</span><br><span style="color: hsl(120, 100%, 40%);">+      void *data)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        return internal_stasis_subscribe(topic, callback, data, 1, 1, __FILE__, __LINE__, __PRETTY_FUNCTION__);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/main/stasis_cache.c b/main/stasis_cache.c</span><br><span>index 73a469e..ee8a1dd 100644</span><br><span>--- a/main/stasis_cache.c</span><br><span>+++ b/main/stasis_cache.c</span><br><span>@@ -984,11 +984,7 @@</span><br><span>   }</span><br><span>    ast_free(new_name);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span>    caching_topic->sub = internal_stasis_subscribe(original_topic, caching_topic_exec, caching_topic, 0, 0, __FILE__, __LINE__, __PRETTY_FUNCTION__);</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-       caching_topic->sub = internal_stasis_subscribe(original_topic, caching_topic_exec, caching_topic, 0, 0);</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span>    if (caching_topic->sub == NULL) {</span><br><span>                 ao2_ref(caching_topic, -1);</span><br><span> </span><br><span>diff --git a/main/stasis_message_router.c b/main/stasis_message_router.c</span><br><span>index 9a390ef..f320c34 100644</span><br><span>--- a/main/stasis_message_router.c</span><br><span>+++ b/main/stasis_message_router.c</span><br><span>@@ -204,14 +204,9 @@</span><br><span>  }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> static struct stasis_message_router *stasis_message_router_create_internal(</span><br><span>  struct stasis_topic *topic, int use_thread_pool, const char *file, int lineno,</span><br><span>       const char *func)</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-static struct stasis_message_router *stasis_message_router_create_internal(</span><br><span style="color: hsl(0, 100%, 40%);">-       struct stasis_topic *topic, int use_thread_pool)</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> {</span><br><span>  int res;</span><br><span>     struct stasis_message_router *router;</span><br><span>@@ -230,19 +225,11 @@</span><br><span>                return NULL;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span>      if (use_thread_pool) {</span><br><span>               router->subscription = __stasis_subscribe_pool(topic, router_dispatch, router, file, lineno, func);</span><br><span>       } else {</span><br><span>             router->subscription = __stasis_subscribe(topic, router_dispatch, router, file, lineno, func);</span><br><span>    }</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-  if (use_thread_pool) {</span><br><span style="color: hsl(0, 100%, 40%);">-          router->subscription = stasis_subscribe_pool(topic, router_dispatch, router);</span><br><span style="color: hsl(0, 100%, 40%);">-        } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                router->subscription = stasis_subscribe(topic, router_dispatch, router);</span><br><span style="color: hsl(0, 100%, 40%);">-     }</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span>  if (!router->subscription) {</span><br><span>              ao2_ref(router, -1);</span><br><span>@@ -256,33 +243,17 @@</span><br><span>         return router;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_message_router *__stasis_message_router_create(</span><br><span>   struct stasis_topic *topic, const char *file, int lineno, const char *func)</span><br><span> {</span><br><span>     return stasis_message_router_create_internal(topic, 0, file, lineno, func);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-struct stasis_message_router *stasis_message_router_create(</span><br><span style="color: hsl(0, 100%, 40%);">-        struct stasis_topic *topic)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-    return stasis_message_router_create_internal(topic, 0);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span> struct stasis_message_router *__stasis_message_router_create_pool(</span><br><span>   struct stasis_topic *topic, const char *file, int lineno, const char *func)</span><br><span> {</span><br><span>     return stasis_message_router_create_internal(topic, 1, file, lineno, func);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-struct stasis_message_router *stasis_message_router_create_pool(</span><br><span style="color: hsl(0, 100%, 40%);">-   struct stasis_topic *topic)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-    return stasis_message_router_create_internal(topic, 1);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> </span><br><span> void stasis_message_router_unsubscribe(struct stasis_message_router *router)</span><br><span> {</span><br><span>@@ -440,3 +411,23 @@</span><br><span> </span><br><span>   return;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef AST_DEVMODE</span><br><span style="color: hsl(120, 100%, 40%);">+#undef stasis_message_router_create</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_message_router *stasis_message_router_create(</span><br><span style="color: hsl(120, 100%, 40%);">+  struct stasis_topic *topic);</span><br><span style="color: hsl(120, 100%, 40%);">+#undef stasis_message_router_create_pool</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_message_router *stasis_message_router_create_pool(</span><br><span style="color: hsl(120, 100%, 40%);">+      struct stasis_topic *topic);</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_message_router *stasis_message_router_create(</span><br><span style="color: hsl(120, 100%, 40%);">+     struct stasis_topic *topic)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        return stasis_message_router_create_internal(topic, 0, __FILE__, __LINE__, __PRETTY_FUNCTION__);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_message_router *stasis_message_router_create_pool(</span><br><span style="color: hsl(120, 100%, 40%);">+       struct stasis_topic *topic)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        return stasis_message_router_create_internal(topic, 1, __FILE__, __LINE__, __PRETTY_FUNCTION__);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10841">change 10841</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10841"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I872c04842ab6b61e9dd6d37e4166bc619aa20626 </div>
<div style="display:none"> Gerrit-Change-Number: 10841 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Matthew Fredrickson <creslin@digium.com> </div>