*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+/* Initializes 'list' with pointers that will (probably) cause segfaults if
+ * dereferenced and, better yet, show up clearly in a debugger. */
+void
+list_poison(struct list *list)
+{
+ memset(list, 0xcc, sizeof *list);
+}
+
/* Inserts 'elem' just before 'before'. */
void
list_insert(struct list *before, struct list *elem)
{
/* Inserts 'elem' just before 'before'. */
void
list_insert(struct list *before, struct list *elem)
{
- if (first == last)
- return;
- last = last->prev;
-
- /* Cleanly remove 'first'...'last' from its current list. */
- first->prev->next = last->next;
- last->next->prev = first->prev;
-
- /* Splice 'first'...'last' into new list. */
- first->prev = before->prev;
- last->next = before;
- before->prev->next = first;
- before->prev = last;
+ if (first == last)
+ return;
+ last = last->prev;
+
+ /* Cleanly remove 'first'...'last' from its current list. */
+ first->prev->next = last->next;
+ last->next->prev = first->prev;
+
+ /* Splice 'first'...'last' into new list. */
+ first->prev = before->prev;
+ last->next = before;
+ before->prev->next = first;
+ before->prev = last;
}
/* Returns true if 'list' is empty, false otherwise. */
bool
list_is_empty(const struct list *list)
{
}
/* Returns true if 'list' is empty, false otherwise. */
bool
list_is_empty(const struct list *list)
{