diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-24 23:10:06 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-24 23:10:06 +0000 |
commit | daedd05a267f8afd1b8ca03e337bb2c7c1e9fa91 (patch) | |
tree | c49fe46408c0957140d179faa39614615eb59bc8 /include | |
parent | 195f85020c77522946dda2f9ca365148c7d805c3 (diff) |
make AST_LIST_REMOVE_HEAD safer to use
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6394 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-x | include/asterisk/linkedlists.h | 9 |
1 files changed, 5 insertions, 4 deletions
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; \ }) |