aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/linkedlists.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h
index ef54ed444..8cf251b8b 100644
--- a/include/asterisk/linkedlists.h
+++ b/include/asterisk/linkedlists.h
@@ -274,9 +274,11 @@ struct { \
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field) { \
typeof((head)->first) __list_next; \
typeof((head)->first) __list_prev = NULL; \
- for ((var) = (head)->first, __list_next = (var) ? (var)->field.next : NULL; \
+ typeof((head)->first) __new_prev = NULL; \
+ for ((var) = (head)->first, __new_prev = (var), \
+ __list_next = (var) ? (var)->field.next : NULL; \
(var); \
- __list_prev = (var), (var) = __list_next, \
+ __list_prev = __new_prev, (var) = __list_next, \
__list_next = (var) ? (var)->field.next : NULL \
)
@@ -292,6 +294,7 @@ struct { \
previous entry, if any).
*/
#define AST_LIST_REMOVE_CURRENT(head, field) \
+ __new_prev = __list_prev; \
if (__list_prev) \
__list_prev->field.next = __list_next; \
else \