nostrdb: ccan: sync with normal versions.
This is the version of CCAN which CLN was using at the time these were taken. Unfortunately lots of whitespace has been changed, but AFAICT no source changes. Here's the command I ran (with ../ccan checked out to 1ae4c432): ``` make update-ccan CCAN_NEW="alignof array_size build_assert check_type container_of cppmagic likely list mem short_types str structeq take tal tal/str typesafe_cb utf8 endian crypto/sha256" ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
201cdd7edc
commit
a8d7d971b1
@@ -4,40 +4,40 @@
|
||||
#include "list.h"
|
||||
|
||||
static void *corrupt(const char *abortstr,
|
||||
const struct list_node *head,
|
||||
const struct list_node *node,
|
||||
unsigned int count)
|
||||
const struct list_node *head,
|
||||
const struct list_node *node,
|
||||
unsigned int count)
|
||||
{
|
||||
if (abortstr) {
|
||||
fprintf(stderr,
|
||||
"%s: prev corrupt in node %p (%u) of %p\n",
|
||||
abortstr, node, count, head);
|
||||
abort();
|
||||
}
|
||||
return NULL;
|
||||
if (abortstr) {
|
||||
fprintf(stderr,
|
||||
"%s: prev corrupt in node %p (%u) of %p\n",
|
||||
abortstr, node, count, head);
|
||||
abort();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct list_node *list_check_node(const struct list_node *node,
|
||||
const char *abortstr)
|
||||
const char *abortstr)
|
||||
{
|
||||
const struct list_node *p, *n;
|
||||
int count = 0;
|
||||
const struct list_node *p, *n;
|
||||
int count = 0;
|
||||
|
||||
for (p = node, n = node->next; n != node; p = n, n = n->next) {
|
||||
count++;
|
||||
if (n->prev != p)
|
||||
return corrupt(abortstr, node, n, count);
|
||||
}
|
||||
/* Check prev on head node. */
|
||||
if (node->prev != p)
|
||||
return corrupt(abortstr, node, node, 0);
|
||||
for (p = node, n = node->next; n != node; p = n, n = n->next) {
|
||||
count++;
|
||||
if (n->prev != p)
|
||||
return corrupt(abortstr, node, n, count);
|
||||
}
|
||||
/* Check prev on head node. */
|
||||
if (node->prev != p)
|
||||
return corrupt(abortstr, node, node, 0);
|
||||
|
||||
return (struct list_node *)node;
|
||||
return (struct list_node *)node;
|
||||
}
|
||||
|
||||
struct list_head *list_check(const struct list_head *h, const char *abortstr)
|
||||
{
|
||||
if (!list_check_node(&h->n, abortstr))
|
||||
return NULL;
|
||||
return (struct list_head *)h;
|
||||
if (!list_check_node(&h->n, abortstr))
|
||||
return NULL;
|
||||
return (struct list_head *)h;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user