]> git.ozlabs.org Git - ccan/commitdiff
list: fix uninitialized variable in list_add example.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 10 Nov 2010 06:37:29 +0000 (17:07 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 10 Nov 2010 06:37:29 +0000 (17:07 +1030)
gcc with optimization complained (correctly) about this.

ccan/list/list.h

index 9cb41abd8a339ba3880b5997390c4908aafe9020..3496294b52c89acc65ac10f58398ff4e08bfe523 100644 (file)
@@ -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.
  * Example:
- *     struct child *child;
+ *     struct child *child = malloc(sizeof(*child));
  *
+ *     child->name = "marvin";
  *     list_add(&parent->children, &child->list);
  *     parent->num_children++;
  */