Browse Source

list: add parens to gaurd macro args in LIST_INIT

When other macros are emitting LIST_INIT expansions, `name` can get a
bit complicated.

Signed-off-by: Cody P Schafer <dev@codyps.com>
Cody P Schafer 9 years ago
parent
commit
2102213c75
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ccan/list/list.h

+ 1 - 1
ccan/list/list.h

@@ -111,7 +111,7 @@ struct list_node *list_check_node(const struct list_node *n,
  * Example:
  * Example:
  *	static struct list_head my_list = LIST_HEAD_INIT(my_list);
  *	static struct list_head my_list = LIST_HEAD_INIT(my_list);
  */
  */
-#define LIST_HEAD_INIT(name) { { &name.n, &name.n } }
+#define LIST_HEAD_INIT(name) { { &(name).n, &(name).n } }
 
 
 /**
 /**
  * LIST_HEAD - define and initialize an empty list_head
  * LIST_HEAD - define and initialize an empty list_head