Permalink
Browse files

Rename list_* to elist_*, to avoid conflicting with mysql (grumble)

  • Loading branch information...
1 parent 2817e1d commit 8e7fffde1ad3567a205f79d9e772fed3b7c45825 Jeff Garzik committed with Apr 3, 2011
Showing with 135 additions and 135 deletions.
  1. +9 −9 anet.c
  2. +2 −2 anet.h
  3. +3 −3 config.c
  4. +58 −58 elist.h
  5. +14 −14 hist.c
  6. +13 −13 htab.c
  7. +12 −12 msg.c
  8. +17 −17 server.c
  9. +7 −7 server.h
View
18 anet.c
@@ -35,16 +35,16 @@ void tcp_read_init(struct tcp_read_state *rst, int fd, void *priv)
rst->fd = fd;
rst->priv = priv;
- INIT_LIST_HEAD(&rst->q);
+ INIT_ELIST_HEAD(&rst->q);
}
void tcp_read_free(struct tcp_read_state *rst)
{
struct tcp_read *rd, *tmp;
bool ok = true;
- list_for_each_entry_safe(rd, tmp, &rst->q, node) {
- list_del(&rd->node);
+ elist_for_each_entry_safe(rd, tmp, &rst->q, node) {
+ elist_del(&rd->node);
if (rd->cb)
ok = rd->cb(rst->priv, rd->priv, 0, false);
@@ -73,9 +73,9 @@ bool tcp_read(struct tcp_read_state *rst,
rd->len = buflen;
rd->cb = cb;
rd->priv = priv;
- INIT_LIST_HEAD(&rd->node);
+ INIT_ELIST_HEAD(&rd->node);
- list_add_tail(&rd->node, &rst->q);
+ elist_add_tail(&rd->node, &rst->q);
return true;
}
@@ -99,9 +99,9 @@ bool tcp_read_inf(struct tcp_read_state *rst,
rd->check_compl_cb = check_compl_cb;
rd->cb = cb;
rd->priv = priv;
- INIT_LIST_HEAD(&rd->node);
+ INIT_ELIST_HEAD(&rd->node);
- list_add_tail(&rd->node, &rst->q);
+ elist_add_tail(&rd->node, &rst->q);
return true;
}
@@ -208,7 +208,7 @@ static int tcp_read_exec(struct tcp_read_state *rst, struct tcp_read *rd)
if (rd->cb)
ok = rd->cb(rst->priv, rd->priv, rd->curlen, true);
- list_del(&rd->node);
+ elist_del(&rd->node);
memset(rd, 0, sizeof(*rd)); /* poison */
free(rd);
@@ -221,7 +221,7 @@ bool tcp_read_runq(struct tcp_read_state *rst)
struct tcp_read *rd, *tmp;
bool ok = true;
- list_for_each_entry_safe(rd, tmp, &rst->q, node) {
+ elist_for_each_entry_safe(rd, tmp, &rst->q, node) {
int rc;
rc = tcp_read_exec(rst, rd);
View
4 anet.h
@@ -14,11 +14,11 @@ struct tcp_read {
bool (*cb)(void *, void *,
unsigned int, bool); /* callback*/
void *priv; /* app-private callback arg */
- struct list_head node;
+ struct elist_head node;
};
struct tcp_read_state {
- struct list_head q; /* read queue */
+ struct elist_head q; /* read queue */
int fd; /* network socket fd */
void *priv; /* app-specific data */
View
@@ -144,13 +144,13 @@ static void parse_listen(const json_t *listeners)
lc->proto = LP_BC_BINARY;
}
- INIT_LIST_HEAD(&lc->listeners_node);
+ INIT_ELIST_HEAD(&lc->listeners_node);
if (host_str)
lc->host = strdup(host_str);
lc->port = port;
- list_add_tail(&lc->listeners_node, &srv.listeners);
+ elist_add_tail(&lc->listeners_node, &srv.listeners);
}
}
@@ -234,7 +234,7 @@ void read_config(void)
parse_listen(json_object_get(jcfg, "listen"));
parse_database(json_object_get(jcfg, "database"));
- if (list_empty(&srv.listeners)) {
+ if (elist_empty(&srv.listeners)) {
applog(LOG_ERR, "error: no listen addresses specified");
exit(1);
}
View
116 elist.h
@@ -11,16 +11,16 @@
* using the generic single-entry routines.
*/
-struct list_head {
- struct list_head *next, *prev;
+struct elist_head {
+ struct elist_head *next, *prev;
};
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
+#define ELIST_HEAD_INIT(name) { &(name), &(name) }
-#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
+#define ELIST_HEAD(name) \
+ struct elist_head name = ELIST_HEAD_INIT(name)
-#define INIT_LIST_HEAD(ptr) do { \
+#define INIT_ELIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
@@ -30,9 +30,9 @@ struct list_head {
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static inline void __list_add(struct list_head *new,
- struct list_head *prev,
- struct list_head *next)
+static inline void __list_add(struct elist_head *new,
+ struct elist_head *prev,
+ struct elist_head *next)
{
next->prev = new;
new->next = next;
@@ -41,27 +41,27 @@ static inline void __list_add(struct list_head *new,
}
/**
- * list_add - add a new entry
+ * elist_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
-static inline void list_add(struct list_head *new, struct list_head *head)
+static inline void elist_add(struct elist_head *new, struct elist_head *head)
{
__list_add(new, head, head->next);
}
/**
- * list_add_tail - add a new entry
+ * elist_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
+static inline void elist_add_tail(struct elist_head *new, struct elist_head *head)
{
__list_add(new, head->prev, head);
}
@@ -73,72 +73,72 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static inline void __list_del(struct list_head *prev, struct list_head *next)
+static inline void __list_del(struct elist_head *prev, struct elist_head *next)
{
next->prev = prev;
prev->next = next;
}
/**
- * list_del - deletes entry from list.
+ * elist_del - deletes entry from list.
* @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
+ * Note: elist_empty on entry does not return true after this, the entry is in an undefined state.
*/
-static inline void list_del(struct list_head *entry)
+static inline void elist_del(struct elist_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (void *) 0;
entry->prev = (void *) 0;
}
/**
- * list_del_init - deletes entry from list and reinitialize it.
+ * elist_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
-static inline void list_del_init(struct list_head *entry)
+static inline void elist_del_init(struct elist_head *entry)
{
__list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
+ INIT_ELIST_HEAD(entry);
}
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
*/
-static inline void list_move(struct list_head *list, struct list_head *head)
+static inline void list_move(struct elist_head *list, struct elist_head *head)
{
__list_del(list->prev, list->next);
- list_add(list, head);
+ elist_add(list, head);
}
/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
*/
-static inline void list_move_tail(struct list_head *list,
- struct list_head *head)
+static inline void list_move_tail(struct elist_head *list,
+ struct elist_head *head)
{
__list_del(list->prev, list->next);
- list_add_tail(list, head);
+ elist_add_tail(list, head);
}
/**
- * list_empty - tests whether a list is empty
+ * elist_empty - tests whether a list is empty
* @head: the list to test.
*/
-static inline int list_empty(struct list_head *head)
+static inline int elist_empty(struct elist_head *head)
{
return head->next == head;
}
-static inline void __list_splice(struct list_head *list,
- struct list_head *head)
+static inline void __list_splice(struct elist_head *list,
+ struct elist_head *head)
{
- struct list_head *first = list->next;
- struct list_head *last = list->prev;
- struct list_head *at = head->next;
+ struct elist_head *first = list->next;
+ struct elist_head *last = list->prev;
+ struct elist_head *at = head->next;
first->prev = head;
head->next = first;
@@ -152,9 +152,9 @@ static inline void __list_splice(struct list_head *list,
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
-static inline void list_splice(struct list_head *list, struct list_head *head)
+static inline void list_splice(struct elist_head *list, struct elist_head *head)
{
- if (!list_empty(list))
+ if (!elist_empty(list))
__list_splice(list, head);
}
@@ -165,35 +165,35 @@ static inline void list_splice(struct list_head *list, struct list_head *head)
*
* The list at @list is reinitialised
*/
-static inline void list_splice_init(struct list_head *list,
- struct list_head *head)
+static inline void list_splice_init(struct elist_head *list,
+ struct elist_head *head)
{
- if (!list_empty(list)) {
+ if (!elist_empty(list)) {
__list_splice(list, head);
- INIT_LIST_HEAD(list);
+ INIT_ELIST_HEAD(list);
}
}
/**
- * list_entry - get the struct for this entry
- * @ptr: the &struct list_head pointer.
+ * elist_entry - get the struct for this entry
+ * @ptr: the &struct elist_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
-#define list_entry(ptr, type, member) \
+#define elist_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
/**
- * list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop counter.
+ * elist_for_each - iterate over a list
+ * @pos: the &struct elist_head to use as a loop counter.
* @head: the head for your list.
*/
-#define list_for_each(pos, head) \
+#define elist_for_each(pos, head) \
for (pos = (head)->next; pos != (head); \
pos = pos->next)
/**
* list_for_each_prev - iterate over a list backwards
- * @pos: the &struct list_head to use as a loop counter.
+ * @pos: the &struct elist_head to use as a loop counter.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
@@ -202,37 +202,37 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
- * @pos: the &struct list_head to use as a loop counter.
- * @n: another &struct list_head to use as temporary storage
+ * @pos: the &struct elist_head to use as a loop counter.
+ * @n: another &struct elist_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
/**
- * list_for_each_entry - iterate over list of given type
+ * elist_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
-#define list_for_each_entry(pos, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member); \
+#define elist_for_each_entry(pos, head, member) \
+ for (pos = elist_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
- pos = list_entry(pos->member.next, typeof(*pos), member))
+ pos = elist_entry(pos->member.next, typeof(*pos), member))
/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * elist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
-#define list_for_each_entry_safe(pos, n, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \
- n = list_entry(pos->member.next, typeof(*pos), member); \
+#define elist_for_each_entry_safe(pos, n, head, member) \
+ for (pos = elist_entry((head)->next, typeof(*pos), member), \
+ n = elist_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
- pos = n, n = list_entry(n->member.next, typeof(*n), member))
+ pos = n, n = elist_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_continue - iterate over list of given type
@@ -242,10 +242,10 @@ static inline void list_splice_init(struct list_head *list,
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_continue(pos, head, member) \
- for (pos = list_entry(pos->member.next, typeof(*pos), member), \
+ for (pos = elist_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next); \
&pos->member != (head); \
- pos = list_entry(pos->member.next, typeof(*pos), member), \
+ pos = elist_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next))
#endif
Oops, something went wrong.

0 comments on commit 8e7fffd

Please sign in to comment.