diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-12 23:44:56 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-12 23:44:56 +0100 | 
| commit | b46769d05371e501800a4658a0faf82c4ccdb0dd (patch) | |
| tree | 59958fdff715c3b8b4700e0dc813e6d6dffb8ff8 /lib | |
| parent | be7a180689ba5dc2b1cd1dc14f55c59246e238ed (diff) | |
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.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/xmltree.c | 20 | ||||
| -rw-r--r-- | lib/xmltree.h | 1 | 
2 files changed, 21 insertions, 0 deletions
| 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; diff --git a/lib/xmltree.h b/lib/xmltree.h index 34e3be68..ddb3f02f 100644 --- a/lib/xmltree.h +++ b/lib/xmltree.h @@ -91,6 +91,7 @@ char *xt_find_attr( struct xt_node *node, const char *key );  struct xt_node *xt_new_node( char *name, const char *text, struct xt_node *children );  void xt_add_child( struct xt_node *parent, struct xt_node *child ); +void xt_insert_child( struct xt_node *parent, struct xt_node *child );  void xt_add_attr( struct xt_node *node, const char *key, const char *value );  int xt_remove_attr( struct xt_node *node, const char *key ); | 
