From b46769d05371e501800a4658a0faf82c4ccdb0dd Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 12 Aug 2010 23:44:56 +0100 Subject: Some syntax checking fixups; don't make the same mistake of failing just if the MSN server is sending a little bit *more* info. And adding xt_insert_node() used in the ADL generation code. --- lib/xmltree.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/xmltree.c') diff --git a/lib/xmltree.c b/lib/xmltree.c index b0a945ce..00b37ae6 100644 --- a/lib/xmltree.c +++ b/lib/xmltree.c @@ -549,6 +549,26 @@ void xt_add_child( struct xt_node *parent, struct xt_node *child ) } } +/* Same, but at the beginning. */ +void xt_insert_child( struct xt_node *parent, struct xt_node *child ) +{ + struct xt_node *node, *last; + + for( node = child; node; node = node->next ) + { + if( node->parent != NULL ) + { + /* ERROR CONDITION: They seem to have a parent already??? */ + } + + node->parent = parent; + last = node; + } + + last->next = parent->children; + parent->children = child; +} + void xt_add_attr( struct xt_node *node, const char *key, const char *value ) { int i; -- cgit v1.2.3