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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cdr.c: Set stringfields only if they are different.<br><br>The CDR performance gets worse the further it gets behind in processing<br>stasis messages.  One of the reasons is we were repeatedly setting string<br>fields to potentially the same string in base_process_party_a().  Setting<br>a string field involves allocating room for the new string out of a memory<br>pool which may have to allocate even more memory.<br><br>* Check to see if the string field is already set to the desired string.<br><br>ASTERISK-27335<br><br>Change-Id: I3ccb7e23f1488417e08cafe477755033eed65a7c<br>---<br>M main/cdr.c<br>1 file changed, 18 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/cdr.c b/main/cdr.c<br>index fc125f2..6a3365e 100644<br>--- a/main/cdr.c<br>+++ b/main/cdr.c<br>@@ -1378,8 +1378,12 @@<br>          */<br>   if (!ast_test_flag(&snapshot->flags, AST_FLAG_SUBROUTINE_EXEC)<br>                 || ast_test_flag(&snapshot->softhangup_flags, AST_SOFTHANGUP_HANGUP_EXEC)) {<br>-          ast_string_field_set(cdr, context, snapshot->context);<br>-            ast_string_field_set(cdr, exten, snapshot->exten);<br>+                if (strcmp(cdr->context, snapshot->context)) {<br>+                 ast_string_field_set(cdr, context, snapshot->context);<br>+            }<br>+            if (strcmp(cdr->exten, snapshot->exten)) {<br>+                     ast_string_field_set(cdr, exten, snapshot->exten);<br>+                }<br>     }<br> <br>  cdr_object_swap_snapshot(&cdr->party_a, snapshot);<br>@@ -1389,11 +1393,15 @@<br>     * of "AppDialX". Prevent that, and any other application changes we might not want<br>          * here.<br>       */<br>-  if (!ast_strlen_zero(snapshot->appl)<br>-                      && (strncasecmp(snapshot->appl, "appdial", 7) || ast_strlen_zero(cdr->appl))<br>-                 && !ast_test_flag(&cdr->flags, AST_CDR_LOCK_APP)) {<br>-           ast_string_field_set(cdr, appl, snapshot->appl);<br>-          ast_string_field_set(cdr, data, snapshot->data);<br>+  if (!ast_test_flag(&cdr->flags, AST_CDR_LOCK_APP)<br>+             && !ast_strlen_zero(snapshot->appl)<br>+               && (strncasecmp(snapshot->appl, "appdial", 7) || ast_strlen_zero(cdr->appl))) {<br>+              if (strcmp(cdr->appl, snapshot->appl)) {<br>+                       ast_string_field_set(cdr, appl, snapshot->appl);<br>+          }<br>+            if (strcmp(cdr->data, snapshot->data)) {<br>+                       ast_string_field_set(cdr, data, snapshot->data);<br>+          }<br> <br>          /* Dial (app_dial) is a special case. Because pre-dial handlers, which<br>                 * execute before the dial begins, will alter the application/data to<br>@@ -1405,7 +1413,9 @@<br>          }<br>     }<br> <br>- ast_string_field_set(cdr, linkedid, snapshot->linkedid);<br>+  if (strcmp(cdr->linkedid, snapshot->linkedid)) {<br>+               ast_string_field_set(cdr, linkedid, snapshot->linkedid);<br>+  }<br>     cdr_object_check_party_a_answer(cdr);<br>         cdr_object_check_party_a_hangup(cdr);<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6783">change 6783</a>. To unsubscribe, 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/6783"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I3ccb7e23f1488417e08cafe477755033eed65a7c </div>
<div style="display:none"> Gerrit-Change-Number: 6783 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>