]> git.ozlabs.org Git - ccan/blobdiff - ccan/tal/tal.c
tal: neaten child property initialization.
[ccan] / ccan / tal / tal.c
index 612c67bb833f65de486a3c0d534487efc761d85e..9fed477fe9595bd4e85d5243f1315c602915a830 100644 (file)
@@ -294,6 +294,7 @@ static struct children *add_child_property(struct tal_hdr *parent,
 
                init_group_property(&prop->group, prop, child);
                list_head_init(&prop->group.list);
+               update_bounds(&prop->group);
        }
        return prop;
 }
@@ -316,8 +317,7 @@ static bool add_child(struct tal_hdr *parent, struct tal_hdr *child)
                children = add_child_property(parent, child);
                if (!children)
                        return false;
-               children->group.list.n.next = children->group.list.n.prev
-                       = &children->group.list.n;
+               list_head_init(&children->group.list);
 
                /* Child links to itself. */
                 child->next = child;
@@ -887,7 +887,8 @@ static bool check_node(struct group *group,
                        name = (struct name *)p;
                        break;
                }
-               if (p != &null_parent.c.hdr && !in_bounds(p))
+               if (p != &null_parent.c.hdr && p != &null_parent.c.group.hdr
+                   && !in_bounds(p))
                        return check_err(t, errorstr,
                                         "has bad property pointer");