aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/astobj2.h12
-rw-r--r--include/asterisk/frame.h9
-rw-r--r--include/asterisk/linkedlists.h26
3 files changed, 38 insertions, 9 deletions
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index dd154ec85..ec841b888 100644
--- a/include/asterisk/astobj2.h
+++ b/include/asterisk/astobj2.h
@@ -188,15 +188,15 @@ int ao2_ref(void *o, int delta);
#ifndef DEBUG_THREADS
int ao2_lock(void *a);
#else
-#define ao2_lock(a) _ao2_lock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int _ao2_lock(void *a, const char *file, const char *func, int line, const char *var);
+#define ao2_lock(a) __ao2_lock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
+int __ao2_lock(void *a, const char *file, const char *func, int line, const char *var);
#endif
#ifndef DEBUG_THREADS
int ao2_trylock(void *a);
#else
-#define ao2_trylock(a) _ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int _ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
+#define ao2_trylock(a) __ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
+int __ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
#endif
/*!
@@ -208,8 +208,8 @@ int _ao2_trylock(void *a, const char *file, const char *func, int line, const ch
#ifndef DEBUG_THREADS
int ao2_unlock(void *a);
#else
-#define ao2_unlock(a) _ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int _ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
+#define ao2_unlock(a) __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
+int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
#endif
/*!
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index bb5026908..f874643c0 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -399,9 +399,9 @@ struct ast_frame *ast_fralloc(char *source, int len);
#endif
/*!
- * \brief Frees a frame
+ * \brief Frees a frame or list of frames
*
- * \param fr Frame to free
+ * \param fr Frame to free, or head of list to free
* \param cache Whether to consider this frame for frame caching
*/
void ast_frame_free(struct ast_frame *fr, int cache);
@@ -415,6 +415,11 @@ void ast_frame_free(struct ast_frame *fr, int cache);
* data malloc'd. If you need to store frames, say for queueing, then
* you should call this function.
* \return Returns a frame on success, NULL on error
+ * \note This function may modify the frame passed to it, so you must
+ * not assume the frame will be intact after the isolated frame has
+ * been produced. In other words, calling this function on a frame
+ * should be the last operation you do with that frame before freeing
+ * it (or exiting the block, if the frame is on the stack.)
*/
struct ast_frame *ast_frisolate(struct ast_frame *fr);
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h
index bd7f6a9b1..7981c556c 100644
--- a/include/asterisk/linkedlists.h
+++ b/include/asterisk/linkedlists.h
@@ -685,7 +685,7 @@ struct { \
\param head This is a pointer to the list head structure
\param list This is a pointer to the list to be appended.
\param field This is the name of the field (declared using AST_LIST_ENTRY())
- used to link entries of this list together.
+ used to link entries of the lists together.
Note: The source list (the \a list parameter) will be empty after
calling this macro (the list entries are \b moved to the target list).
@@ -705,6 +705,30 @@ struct { \
#define AST_RWLIST_APPEND_LIST AST_LIST_APPEND_LIST
/*!
+ \brief Inserts a whole list after a specific entry in a list
+ \param head This is a pointer to the list head structure
+ \param list This is a pointer to the list to be inserted.
+ \param elm This is a pointer to the entry after which the new list should
+ be inserted.
+ \param field This is the name of the field (declared using AST_LIST_ENTRY())
+ used to link entries of the lists together.
+
+ Note: The source list (the \a list parameter) will be empty after
+ calling this macro (the list entries are \b moved to the target list).
+ */
+#define AST_LIST_INSERT_LIST_AFTER(head, list, elm, field) do { \
+ (list)->last->field.next = (elm)->field.next; \
+ (elm)->field.next = (list)->first; \
+ if ((head)->last == elm) { \
+ (head)->last = (list)->last; \
+ } \
+ (list)->first = NULL; \
+ (list)->last = NULL; \
+} while(0)
+
+#define AST_RWLIST_INSERT_LIST_AFTER AST_LIST_INSERT_LIST_AFTER
+
+/*!
\brief Removes and returns the head entry from a list.
\param head This is a pointer to the list head structure
\param field This is the name of the field (declared using AST_LIST_ENTRY())