1 /* Licensed under BSD-MIT - see LICENSE file for details */
6 static void *corrupt(const char *abortstr,
7 const struct list_node *head,
8 const struct list_node *node,
13 "%s: prev corrupt in node %p (%u) of %p\n",
14 abortstr, node, count, head);
20 struct list_node *list_check_node(const struct list_node *node,
23 const struct list_node *p, *n;
26 for (p = node, n = node->next; n != node; p = n, n = n->next) {
29 return corrupt(abortstr, node, n, count);
31 /* Check prev on head node. */
33 return corrupt(abortstr, node, node, 0);
35 return (struct list_node *)node;
38 struct list_head *list_check(const struct list_head *h, const char *abortstr)
40 if (!list_check_node(&h->n, abortstr))
42 return (struct list_head *)h;