<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10690">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Corey Farrell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stasis: Remove stringfields and lock from change message.<br><br>When a subscribe or unsubscribe occurs a message is published<br>containing this information. This change makes it so that the<br>message no longer uses stringfields or a lock, as both are not<br>really needed for the message.<br><br>Change-Id: I3f4831931d79f94fd979baf48048738df5dc1632<br>---<br>M include/asterisk/stasis.h<br>M main/stasis.c<br>2 files changed, 10 insertions(+), 11 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 ebd00ee..85e78dc 100644</span><br><span>--- a/include/asterisk/stasis.h</span><br><span>+++ b/include/asterisk/stasis.h</span><br><span>@@ -806,11 +806,9 @@</span><br><span>  * \since 12</span><br><span>  */</span><br><span> struct stasis_subscription_change {</span><br><span style="color: hsl(0, 100%, 40%);">- AST_DECLARE_STRING_FIELDS(</span><br><span style="color: hsl(0, 100%, 40%);">-              AST_STRING_FIELD(uniqueid);     /*!< The unique ID associated with this subscription */</span><br><span style="color: hsl(0, 100%, 40%);">-              AST_STRING_FIELD(description);  /*!< The description of the change to the subscription associated with the uniqueid */</span><br><span style="color: hsl(0, 100%, 40%);">-       );</span><br><span style="color: hsl(0, 100%, 40%);">-      struct stasis_topic *topic;             /*!< The topic the subscription is/was subscribing to */</span><br><span style="color: hsl(120, 100%, 40%);">+   struct stasis_topic *topic; /*!< The topic the subscription is/was subscribing to */</span><br><span style="color: hsl(120, 100%, 40%);">+       char *uniqueid;             /*!< The unique ID associated with this subscription */</span><br><span style="color: hsl(120, 100%, 40%);">+        char description[0];        /*!< The description of the change to the subscription associated with the uniqueid */</span><br><span> };</span><br><span> </span><br><span> /*!</span><br><span>diff --git a/main/stasis.c b/main/stasis.c</span><br><span>index 93112d9..417caaf 100644</span><br><span>--- a/main/stasis.c</span><br><span>+++ b/main/stasis.c</span><br><span>@@ -1077,22 +1077,23 @@</span><br><span> {</span><br><span>       struct stasis_subscription_change *change = obj;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    ast_string_field_free_memory(change);</span><br><span>        ao2_cleanup(change->topic);</span><br><span> }</span><br><span> </span><br><span> static struct stasis_subscription_change *subscription_change_alloc(struct stasis_topic *topic, const char *uniqueid, const char *description)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+        size_t description_len = strlen(description) + 1;</span><br><span>    struct stasis_subscription_change *change;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  change = ao2_alloc(sizeof(struct stasis_subscription_change), subscription_change_dtor);</span><br><span style="color: hsl(0, 100%, 40%);">-        if (!change || ast_string_field_init(change, 128)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ao2_cleanup(change);</span><br><span style="color: hsl(120, 100%, 40%);">+  change = ao2_alloc_options(sizeof(*change) + description_len + strlen(uniqueid) + 1,</span><br><span style="color: hsl(120, 100%, 40%);">+          subscription_change_dtor, AO2_ALLOC_OPT_LOCK_NOLOCK);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!change) {</span><br><span>               return NULL;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   ast_string_field_set(change, uniqueid, uniqueid);</span><br><span style="color: hsl(0, 100%, 40%);">-       ast_string_field_set(change, description, description);</span><br><span style="color: hsl(120, 100%, 40%);">+       strcpy(change->description, description); /* SAFE */</span><br><span style="color: hsl(120, 100%, 40%);">+       change->uniqueid = change->description + description_len;</span><br><span style="color: hsl(120, 100%, 40%);">+       strcpy(change->uniqueid, uniqueid); /* SAFE */</span><br><span>    ao2_ref(topic, +1);</span><br><span>  change->topic = topic;</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10690">change 10690</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/10690"/><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: I3f4831931d79f94fd979baf48048738df5dc1632 </div>
<div style="display:none"> Gerrit-Change-Number: 10690 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>