From 7950e4216e49a44b51d4dada2b79c5a7d9e741e7 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 24 Aug 2005 23:10:06 +0000 Subject: make AST_LIST_REMOVE_HEAD safer to use git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6394 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/linkedlists.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include/asterisk/linkedlists.h') diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index b4085d7b9..72f19756c 100755 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -305,14 +305,15 @@ struct { \ \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. - Removes the head entry from the list, and returns a pointer to it. The - forward-link pointer in the returned entry is \b not cleared. This macro - is safe to call on an empty list. + Removes the head entry from the list, and returns a pointer to it. + This macro is safe to call on an empty list. */ #define AST_LIST_REMOVE_HEAD(head, field) ({ \ typeof((head)->first) cur = (head)->first; \ - if (cur) \ + if (cur) { \ (head)->first = cur->field.next; \ + cur->field.next = NULL; \ + } \ cur; \ }) -- cgit v1.2.3