Skip to content
Snippets Groups Projects
Commit 9022f35f authored by Sean Bright's avatar Sean Bright Committed by George Joseph
Browse files

vector.h: Add AST_VECTOR_SORT()

Allows a vector to be sorted in-place, rather than only during
insertion.

Change-Id: I22cba9ddf556a7e44dacc53c4431bd81dd2fa780
parent a678dafa
Branches
Tags
No related merge requests found
......@@ -387,6 +387,16 @@ int ast_vector_string_split(struct ast_vector_string *dest,
res; \
})
/*!
* \brief Sort a vector in-place
*
* \param vec Vector to sort
* \param cmp A memcmp compatible compare function
*/
#define AST_VECTOR_SORT(vec, cmp) ({ \
qsort((vec)->elems, (vec)->current, sizeof(typeof((vec)->elems[0])), cmp); \
})
/*!
* \brief Remove an element from a vector by index.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment