2037. [func] When unlinking the first or last element in a list

check that the list head points to the element to
                        be unlinked. [RT #15959]
This commit is contained in:
Mark Andrews
2006-06-05 00:40:01 +00:00
parent 42a9236cbd
commit faab0349cb
3 changed files with 17 additions and 5 deletions
+4
View File
@@ -1,3 +1,7 @@
2037. [func] When unlinking the first or last element in a list
check that the list head points to the element to
be unlinked. [RT #15959]
2034. [bug] gcc: set -fno-strict-aliasing. [RT #16124]
+6 -2
View File
@@ -66,12 +66,16 @@
INSIST(LINKED(elt, link));\
if ((elt)->link.next != NULL) \
(elt)->link.next->link.prev = (elt)->link.prev; \
else \
else { \
INSIST((list).tail == (elt)); \
(list).tail = (elt)->link.prev; \
} \
if ((elt)->link.prev != NULL) \
(elt)->link.prev->link.next = (elt)->link.next; \
else \
else { \
INSIST((list).head == (elt)); \
(list).head = (elt)->link.next; \
} \
INIT_LINK_TYPE(elt, link, type); \
} while (0)
#define UNLINK(list, elt, link) \
+7 -3
View File
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: list.h,v 1.18.2.3 2004/03/09 06:11:57 marka Exp $ */
/* $Id: list.h,v 1.18.2.4 2006/06/05 00:40:01 marka Exp $ */
#ifndef ISC_LIST_H
#define ISC_LIST_H 1
@@ -90,12 +90,16 @@
do { \
if ((elt)->link.next != NULL) \
(elt)->link.next->link.prev = (elt)->link.prev; \
else \
else { \
ISC_INSIST((list).tail == (elt)); \
(list).tail = (elt)->link.prev; \
} \
if ((elt)->link.prev != NULL) \
(elt)->link.prev->link.next = (elt)->link.next; \
else \
else { \
ISC_INSIST((list).head == (elt)); \
(list).head = (elt)->link.next; \
} \
(elt)->link.prev = (type *)(-1); \
(elt)->link.next = (type *)(-1); \
} while (0)