<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14687">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">vector.h: Add AST_VECTOR_SORT()<br><br>This allows a vector be sorted in-place, rather than only during<br>insertion.<br><br>Change-Id: I22cba9ddf556a7e44dacc53c4431bd81dd2fa780<br>---<br>M include/asterisk/vector.h<br>1 file changed, 10 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/14687/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/vector.h b/include/asterisk/vector.h</span><br><span>index 0e33590..1aa1611 100644</span><br><span>--- a/include/asterisk/vector.h</span><br><span>+++ b/include/asterisk/vector.h</span><br><span>@@ -358,6 +358,16 @@</span><br><span> })</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Sort a vector in-place</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param Vector to sort</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param cmp A memcmp compatible compare function</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_VECTOR_SORT(vec, cmp) ({ \</span><br><span style="color: hsl(120, 100%, 40%);">+ qsort((vec)->elems, (vec)->current, sizeof(typeof((vec)->elems[0])), cmp); \</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%);">+/*!</span><br><span> * \brief Remove an element from a vector by index.</span><br><span> *</span><br><span> * Note that elements in the vector may be reordered, so that the remove can</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14687">change 14687</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/c/asterisk/+/14687"/><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-Change-Id: I22cba9ddf556a7e44dacc53c4431bd81dd2fa780 </div>
<div style="display:none"> Gerrit-Change-Number: 14687 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>