<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7205">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">vectors: Add new macro and a string vector definition.<br><br>* AST_VECTOR_STEAL_ELEMENTS - steal the array of elements for use<br>  with non-vector code.<br>* struct ast_vector_string - a vector of 'char *'.<br><br>Change-Id: I104d1b204be03fccf67e02a195596adcb5ab1e42<br>---<br>M include/asterisk/vector.h<br>1 file changed, 21 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/05/7205/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/include/asterisk/vector.h b/include/asterisk/vector.h<br>index 68ce130..1aacda6 100644<br>--- a/include/asterisk/vector.h<br>+++ b/include/asterisk/vector.h<br>@@ -51,6 +51,9 @@<br> /*! \brief Integer vector definition */<br> AST_VECTOR(ast_vector_int, int);<br> <br>+/*! \brief String vector definition */<br>+AST_VECTOR(ast_vector_string, char *);<br>+<br> /*!<br>  * \brief Define a vector structure with a read/write lock<br>  *<br>@@ -91,6 +94,24 @@<br> })<br> <br> /*!<br>+ * \brief Steal the elements from a vector and reinitialize.<br>+ *<br>+ * \param vec Vector to operate on.<br>+ *<br>+ * This allows you to use vector.h to construct a list and use the<br>+ * data as a bare array.<br>+ *<br>+ * \warning AST_VECTOR_SIZE and AST_VECTOR_MAX_SIZE are both reset<br>+ *          to 0.  If either are needed they must be saved to a local<br>+ *          variable before stealing the elements.<br>+ */<br>+#define AST_VECTOR_STEAL_ELEMENTS(vec) ({ \<br>+       typeof((vec)->elems) __elems = (vec)->elems; \<br>+ AST_VECTOR_INIT((vec), 0); \<br>+ (__elems); \<br>+})<br>+<br>+/*!<br>  * \brief Initialize a vector with a read/write lock<br>  *<br>  * If \a size is 0, then no space will be allocated until the vector is<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7205">change 7205</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/7205"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I104d1b204be03fccf67e02a195596adcb5ab1e42 </div>
<div style="display:none"> Gerrit-Change-Number: 7205 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>