]> git.ipfire.org Git - thirdparty/asterisk.git/commit
vector: Traversal, retrieval, insert and locking enhancements 39/339/7
authorGeorge Joseph <george.joseph@fairview5.com>
Sat, 2 May 2015 00:25:17 +0000 (18:25 -0600)
committerGeorge Joseph <george.joseph@fairview5.com>
Tue, 5 May 2015 00:46:51 +0000 (19:46 -0500)
commit7a7e9733c2288e255f6c3bcc2a56f7088e08b834
tree45aaecbb95cf6d49dea99771637e45e74ec099dc
parent626bffc4c2833407540cd8f6024bcb4f672c4a2c
vector:  Traversal, retrieval, insert and locking enhancements

Renamed AST_VECTOR_INSERT to AST_VECTOR_REPLACE because it really
does replace not insert.  The few users of AST_VECTOR_INSERT were
refactored.  Because these are macros, there should be no ABI
compatibility issues.

Added AST_VECTOR_INSERT_AT that actually inserts an element into the
vector at a specific index pushing existing elements to the right.

Added AST_VECTOR_GET_CMP that can retrieve from the vector based
on a user-provided compare function.

Added AST_VECTOR_CALLBACK function that will execute a function
for each element in the vector.  Similar to ao2_callback and
ao2_callback_data functions although the vector callback can take
a variable number of arguments.  This should allow easy migration
to a vector where a container might be too heavy.

Added read/write locked vector and lock manipulation macros.

Added unit tests.

ASTERISK-25045 #close

Change-Id: I2e07ecc709d2f5f91bcab8904e5e9340609b00e0
include/asterisk/vector.h
main/format_cap.c
main/rtp_engine.c
tests/test_message.c
tests/test_vector.c [new file with mode: 0644]