]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2037. [func] When unlinking the first or last element in a list
authorMark Andrews <marka@isc.org>
Mon, 5 Jun 2006 00:40:20 +0000 (00:40 +0000)
committerMark Andrews <marka@isc.org>
Mon, 5 Jun 2006 00:40:20 +0000 (00:40 +0000)
                        check that the list head points to the element to
                        be unlinked. [RT #15959]

CHANGES
lib/bind/include/isc/list.h
lib/isc/include/isc/list.h

diff --git a/CHANGES b/CHANGES
index b4b4f498fa4f695557f88902dc1d56a796810249..70791bb56100ac01f726dd6e25d69e26979e62c0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
+
 2036.  [bug]           'rndc recursing' could cause trigger a REQUIRE.
                        [RT #16075]
 
index ad574ac2b58776f28411098fd2431a974807351e..4e27eb19baea05b5c78766b4d052e4edf82028a8 100644 (file)
                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) \
index 962336ada8a018a8a45106b5bafd34d02419479e..419b380c7537fd74fbcbf607179f59fe9f50a45a 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: list.h,v 1.18.2.2.8.1 2004/03/06 08:14:43 marka Exp $ */
+/* $Id: list.h,v 1.18.2.2.8.2 2006/06/05 00:40:20 marka Exp $ */
 
 #ifndef ISC_LIST_H
 #define ISC_LIST_H 1
        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)