<p>Richard Mudgett <strong>posted comments</strong> on this change.</p><p><a href="https://gerrit.asterisk.org/7774">View Change</a></p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p style="white-space: pre-wrap; word-wrap: break-word;">Some points to consider.</p><p>(2 comments)</p><ul style="list-style: none; padding-left: 20px;"><li><p><a href="https://gerrit.asterisk.org/#/c/7774/1/include/asterisk/astobj2.h">File include/asterisk/astobj2.h:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7774/1/include/asterisk/astobj2.h@2084">Patch Set #1, Line 2084:</a> <code style="font-family:monospace,monospace">        const char *right_key = arg; \</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">The macros assume that the key is a char string.  It doesn't have to be.  The key could be several strings or something else.  I suppose if the key is something else then we'll have to not use the convenience macros since it would be an exception case.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7774/1/include/asterisk/astobj2.h@2093">Patch Set #1, Line 2093:</a> <code style="font-family:monospace,monospace">              cmp = partial_key_cmp(object_left->field, right_key, strlen(right_key)); \</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">A partial key search could pass in a different type to avoid doing a strlen() of the key for every call.  See ao2_reg_sort_cb() for example.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">struct partial_key {<br>  const char *key;<br>  int length;<br>}</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Thus:<br>case OBJ_SEARCH_PARTIAL_KEY:<br>   {<br>      const struct partial_key *partial = arg;<br>      cmp = partial_key_cmp(object_left->field, partial);<br>   }</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Where partial_key_cmp() could be defined as:<br>#define partial_key_cmp(left, partial) \<br>   strncmp(left, partial->key, partial->length)</pre></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/7774">change 7774</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/7774"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I11af8c6a0c43380a42732553f519c667abb842cf </div>
<div style="display:none"> Gerrit-Change-Number: 7774 </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: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 02 Jan 2018 17:55:03 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>