Browse Source

list: fix uninitialized variable in list_add example.

gcc with optimization complained (correctly) about this.
Rusty Russell 15 years ago
parent
commit
c44953a9b9
1 changed files with 2 additions and 1 deletions
  1. 2 1
      ccan/list/list.h

+ 2 - 1
ccan/list/list.h

@@ -106,8 +106,9 @@ static inline void list_head_init(struct list_head *h)
  *
  *
  * The list_node does not need to be initialized; it will be overwritten.
  * The list_node does not need to be initialized; it will be overwritten.
  * Example:
  * Example:
- *	struct child *child;
+ *	struct child *child = malloc(sizeof(*child));
  *
  *
+ *	child->name = "marvin";
  *	list_add(&parent->children, &child->list);
  *	list_add(&parent->children, &child->list);
  *	parent->num_children++;
  *	parent->num_children++;
  */
  */