summaryrefslogtreecommitdiff
path: root/lib/ccan/tlist
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-03-21 00:58:14 +1030
committerRusty Russell <rusty@rustcorp.com.au>2012-03-22 01:57:37 +0100
commit675593221c25dbebaaf8e4ce9f4271a8fb0171d0 (patch)
treee1f57a9e3919adb163c0acf1072708aca912945a /lib/ccan/tlist
parenteafd83736918bc5953e4a91cf2d893e68f2da2a2 (diff)
downloadsamba-675593221c25dbebaaf8e4ce9f4271a8fb0171d0.tar.gz
samba-675593221c25dbebaaf8e4ce9f4271a8fb0171d0.tar.bz2
samba-675593221c25dbebaaf8e4ce9f4271a8fb0171d0.zip
lib/ccan: namespacize ccan/list to avoid conflict with OpenIndiana's sys/list.h
CCAN includes a little utility called "namespacize" which prepends ccan_ to all public methods of a module, and fixes up any dependencies it finds. It's a little primitive, but it works here. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ccan/tlist')
-rw-r--r--lib/ccan/tlist/test/compile_fail-tlist_add.c4
-rw-r--r--lib/ccan/tlist/test/compile_fail-tlist_add_tail.c4
-rw-r--r--lib/ccan/tlist/test/compile_fail-tlist_del_from.c4
-rw-r--r--lib/ccan/tlist/test/compile_fail-tlist_for_each.c4
-rw-r--r--lib/ccan/tlist/test/compile_fail-tlist_for_each_safe.c4
-rw-r--r--lib/ccan/tlist/test/compile_fail-tlist_tail.c4
-rw-r--r--lib/ccan/tlist/test/compile_fail-tlist_top.c4
-rw-r--r--lib/ccan/tlist/test/run.c10
-rw-r--r--lib/ccan/tlist/tlist.h46
9 files changed, 42 insertions, 42 deletions
diff --git a/lib/ccan/tlist/test/compile_fail-tlist_add.c b/lib/ccan/tlist/test/compile_fail-tlist_add.c
index 1b87bfd119..addcf01e9b 100644
--- a/lib/ccan/tlist/test/compile_fail-tlist_add.c
+++ b/lib/ccan/tlist/test/compile_fail-tlist_add.c
@@ -5,12 +5,12 @@ TLIST_TYPE(cousins, struct cousin);
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
struct cousin {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
diff --git a/lib/ccan/tlist/test/compile_fail-tlist_add_tail.c b/lib/ccan/tlist/test/compile_fail-tlist_add_tail.c
index 33dff3d8eb..cfa5d89031 100644
--- a/lib/ccan/tlist/test/compile_fail-tlist_add_tail.c
+++ b/lib/ccan/tlist/test/compile_fail-tlist_add_tail.c
@@ -5,12 +5,12 @@ TLIST_TYPE(cousins, struct cousin);
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
struct cousin {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
diff --git a/lib/ccan/tlist/test/compile_fail-tlist_del_from.c b/lib/ccan/tlist/test/compile_fail-tlist_del_from.c
index d06a72fbfa..d3314dab80 100644
--- a/lib/ccan/tlist/test/compile_fail-tlist_del_from.c
+++ b/lib/ccan/tlist/test/compile_fail-tlist_del_from.c
@@ -5,12 +5,12 @@ TLIST_TYPE(cousins, struct cousin);
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
struct cousin {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
diff --git a/lib/ccan/tlist/test/compile_fail-tlist_for_each.c b/lib/ccan/tlist/test/compile_fail-tlist_for_each.c
index 1b2fb6882f..6ea0183392 100644
--- a/lib/ccan/tlist/test/compile_fail-tlist_for_each.c
+++ b/lib/ccan/tlist/test/compile_fail-tlist_for_each.c
@@ -4,12 +4,12 @@ TLIST_TYPE(children, struct child);
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
struct cousin {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
diff --git a/lib/ccan/tlist/test/compile_fail-tlist_for_each_safe.c b/lib/ccan/tlist/test/compile_fail-tlist_for_each_safe.c
index 651c6cefd6..41a3d923b1 100644
--- a/lib/ccan/tlist/test/compile_fail-tlist_for_each_safe.c
+++ b/lib/ccan/tlist/test/compile_fail-tlist_for_each_safe.c
@@ -4,12 +4,12 @@ TLIST_TYPE(children, struct child);
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
struct cousin {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
diff --git a/lib/ccan/tlist/test/compile_fail-tlist_tail.c b/lib/ccan/tlist/test/compile_fail-tlist_tail.c
index 48f394446e..4022abf4ac 100644
--- a/lib/ccan/tlist/test/compile_fail-tlist_tail.c
+++ b/lib/ccan/tlist/test/compile_fail-tlist_tail.c
@@ -4,12 +4,12 @@ TLIST_TYPE(children, struct child);
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
struct cousin {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
diff --git a/lib/ccan/tlist/test/compile_fail-tlist_top.c b/lib/ccan/tlist/test/compile_fail-tlist_top.c
index 21651400ef..ab3591ff28 100644
--- a/lib/ccan/tlist/test/compile_fail-tlist_top.c
+++ b/lib/ccan/tlist/test/compile_fail-tlist_top.c
@@ -4,12 +4,12 @@ TLIST_TYPE(children, struct child);
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
struct cousin {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
diff --git a/lib/ccan/tlist/test/run.c b/lib/ccan/tlist/test/run.c
index 95b02ebe21..fe75c49125 100644
--- a/lib/ccan/tlist/test/run.c
+++ b/lib/ccan/tlist/test/run.c
@@ -12,7 +12,7 @@ struct parent {
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
int main(int argc, char *argv[])
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
c1.name = "c1";
tlist_add(&parent.children, &c1, list);
- /* Test list_add and !list_empty. */
+ /* Test ccan_list_add and !ccan_list_empty. */
ok1(!tlist_empty(&parent.children));
ok1(c2.list.next == &parent.children.raw.n);
ok1(c2.list.prev == &c1.list);
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
c3.name = "c3";
tlist_add_tail(&parent.children, &c3, list);
- /* Test list_add_tail and !list_empty. */
+ /* Test ccan_list_add_tail and !ccan_list_empty. */
ok1(!tlist_empty(&parent.children));
ok1(parent.children.raw.n.next == &c1.list);
ok1(parent.children.raw.n.prev == &c3.list);
@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
/* Test tlist_top */
ok1(tlist_top(&parent.children, list) == &c1);
- /* Test list_tail */
+ /* Test ccan_list_tail */
ok1(tlist_tail(&parent.children, list) == &c3);
/* Test tlist_for_each. */
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
ok1(i == 3);
ok1(tlist_empty(&parent.children));
- /* Test list_top/list_tail on empty list. */
+ /* Test ccan_list_top/ccan_list_tail on empty list. */
ok1(tlist_top(&parent.children, list) == (struct child *)NULL);
ok1(tlist_tail(&parent.children, list) == (struct child *)NULL);
return exit_status();
diff --git a/lib/ccan/tlist/tlist.h b/lib/ccan/tlist/tlist.h
index 1ce0b85ed9..571ed4e797 100644
--- a/lib/ccan/tlist/tlist.h
+++ b/lib/ccan/tlist/tlist.h
@@ -24,12 +24,12 @@
*
* struct child {
* const char *name;
- * struct list_node list;
+ * struct ccan_list_node list;
* };
*/
#define TLIST_TYPE(suffix, type) \
struct tlist_##suffix { \
- struct list_head raw; \
+ struct ccan_list_head raw; \
TCON(type *canary); \
}
@@ -45,7 +45,7 @@
* Example:
* static struct tlist_children my_list = TLIST_INIT(my_list);
*/
-#define TLIST_INIT(name) { LIST_HEAD_INIT(name.raw) }
+#define TLIST_INIT(name) { CCAN_LIST_HEAD_INIT(name.raw) }
/**
* tlist_check - check head of a list for consistency
@@ -60,7 +60,7 @@
* Returns non-NULL if the list is consistent, NULL otherwise (it
* can never return NULL if @abortstr is set).
*
- * See also: list_check()
+ * See also: ccan_list_check()
*
* Example:
* static void dump_parent(struct parent *p)
@@ -74,7 +74,7 @@
* }
*/
#define tlist_check(h, abortstr) \
- list_check(&(h)->raw, (abortstr))
+ ccan_list_check(&(h)->raw, (abortstr))
/**
* tlist_init - initialize a tlist
@@ -87,7 +87,7 @@
* tlist_init(&parent->children);
* parent->num_children = 0;
*/
-#define tlist_init(h) list_head_init(&(h)->raw)
+#define tlist_init(h) ccan_list_head_init(&(h)->raw)
/**
* tlist_raw - unwrap the typed list and check the type
@@ -106,7 +106,7 @@
* @n: the entry to add to the list.
* @member: the member of n to add to the list.
*
- * The entry's list_node does not need to be initialized; it will be
+ * The entry's ccan_list_node does not need to be initialized; it will be
* overwritten.
* Example:
* struct child *child = malloc(sizeof(*child));
@@ -115,7 +115,7 @@
* tlist_add(&parent->children, child, list);
* parent->num_children++;
*/
-#define tlist_add(h, n, member) list_add(tlist_raw((h), (n)), &(n)->member)
+#define tlist_add(h, n, member) ccan_list_add(tlist_raw((h), (n)), &(n)->member)
/**
* tlist_add_tail - add an entry at the end of a linked list.
@@ -123,13 +123,13 @@
* @n: the entry to add to the list.
* @member: the member of n to add to the list.
*
- * The list_node does not need to be initialized; it will be overwritten.
+ * The ccan_list_node does not need to be initialized; it will be overwritten.
* Example:
* tlist_add_tail(&parent->children, child, list);
* parent->num_children++;
*/
#define tlist_add_tail(h, n, member) \
- list_add_tail(tlist_raw((h), (n)), &(n)->member)
+ ccan_list_add_tail(tlist_raw((h), (n)), &(n)->member)
/**
* tlist_del_from - delete an entry from a linked list.
@@ -150,7 +150,7 @@
* parent->num_children--;
*/
#define tlist_del_from(h, n, member) \
- list_del_from(tlist_raw((h), (n)), &(n)->member)
+ ccan_list_del_from(tlist_raw((h), (n)), &(n)->member)
/**
* tlist_del - delete an entry from an unknown linked list.
@@ -162,7 +162,7 @@
* parent->num_children--;
*/
#define tlist_del(n, member) \
- list_del(&(n)->member)
+ ccan_list_del(&(n)->member)
/**
* tlist_empty - is a list empty?
@@ -173,12 +173,12 @@
* Example:
* assert(tlist_empty(&parent->children) == (parent->num_children == 0));
*/
-#define tlist_empty(h) list_empty(&(h)->raw)
+#define tlist_empty(h) ccan_list_empty(&(h)->raw)
/**
* tlist_top - get the first entry in a list
* @h: the tlist
- * @member: the list_node member of the type
+ * @member: the ccan_list_node member of the type
*
* If the list is empty, returns NULL.
*
@@ -188,14 +188,14 @@
*/
#define tlist_top(h, member) \
((tcon_type((h), canary)) \
- list_top_(&(h)->raw, \
+ ccan_list_top_(&(h)->raw, \
(char *)(&(h)->_tcon[0].canary->member) - \
(char *)((h)->_tcon[0].canary)))
/**
* tlist_tail - get the last entry in a list
* @h: the tlist
- * @member: the list_node member of the type
+ * @member: the ccan_list_node member of the type
*
* If the list is empty, returns NULL.
*
@@ -205,7 +205,7 @@
*/
#define tlist_tail(h, member) \
((tcon_type((h), canary)) \
- list_tail_(&(h)->raw, \
+ ccan_list_tail_(&(h)->raw, \
(char *)(&(h)->_tcon[0].canary->member) - \
(char *)((h)->_tcon[0].canary)))
@@ -213,7 +213,7 @@
* tlist_for_each - iterate through a list.
* @h: the tlist
* @i: an iterator of suitable type for this list.
- * @member: the list_node member of @i
+ * @member: the ccan_list_node member of @i
*
* This is a convenient wrapper to iterate @i over the entire list. It's
* a for loop, so you can break and continue as normal.
@@ -223,13 +223,13 @@
* printf("Name: %s\n", child->name);
*/
#define tlist_for_each(h, i, member) \
- list_for_each(tlist_raw((h), (i)), (i), member)
+ ccan_list_for_each(tlist_raw((h), (i)), (i), member)
/**
* tlist_for_each - iterate through a list backwards.
* @h: the tlist
* @i: an iterator of suitable type for this list.
- * @member: the list_node member of @i
+ * @member: the ccan_list_node member of @i
*
* This is a convenient wrapper to iterate @i over the entire list. It's
* a for loop, so you can break and continue as normal.
@@ -239,14 +239,14 @@
* printf("Name: %s\n", child->name);
*/
#define tlist_for_each_rev(h, i, member) \
- list_for_each_rev(tlist_raw((h), (i)), (i), member)
+ ccan_list_for_each_rev(tlist_raw((h), (i)), (i), member)
/**
* tlist_for_each_safe - iterate through a list, maybe during deletion
* @h: the tlist
* @i: an iterator of suitable type for this list.
* @nxt: another iterator to store the next entry.
- * @member: the list_node member of the structure
+ * @member: the ccan_list_node member of the structure
*
* This is a convenient wrapper to iterate @i over the entire list. It's
* a for loop, so you can break and continue as normal. The extra variable
@@ -260,6 +260,6 @@
* }
*/
#define tlist_for_each_safe(h, i, nxt, member) \
- list_for_each_safe(tlist_raw((h), (i)), (i), (nxt), member)
+ ccan_list_for_each_safe(tlist_raw((h), (i)), (i), (nxt), member)
#endif /* CCAN_TLIST_H */