summaryrefslogtreecommitdiff
path: root/main/format_cap.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2015-05-01 18:25:17 -0600
committerGeorge Joseph <george.joseph@fairview5.com>2015-05-04 18:45:28 -0600
commit6d5941297bddc9c6aff4292fe5d48e3041cd404a (patch)
treefe7dda9ca8a98c9923fd28ec7a4888fbed6df295 /main/format_cap.c
parentce21776aae2866f3c611f172c4d38fb53e806dcf (diff)
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
Diffstat (limited to 'main/format_cap.c')
-rw-r--r--main/format_cap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/format_cap.c b/main/format_cap.c
index 7456a444b..52262579c 100644
--- a/main/format_cap.c
+++ b/main/format_cap.c
@@ -139,7 +139,7 @@ static inline int format_cap_framed_init(struct format_cap_framed *framed, struc
framed->framing = framing;
if (ast_format_get_codec_id(format) >= AST_VECTOR_SIZE(&cap->formats)) {
- if (AST_VECTOR_INSERT(&cap->formats, ast_format_get_codec_id(format), format_cap_framed_list_empty)) {
+ if (AST_VECTOR_REPLACE(&cap->formats, ast_format_get_codec_id(format), format_cap_framed_list_empty)) {
ao2_ref(framed, -1);
return -1;
}