From: Nathan W. <fac...@us...> - 2003-09-30 17:14:18
|
Update of /cvsroot/gaim/gaim/src/protocols/jabber In directory sc8-pr-cvs1:/tmp/cvs-serv10905 Modified Files: xmlnode.c Log Message: this is how this function is supposed to behave Index: xmlnode.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/jabber/xmlnode.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- xmlnode.c 29 Sep 2003 15:23:19 -0000 1.3 +++ xmlnode.c 30 Sep 2003 17:14:14 -0000 1.4 @@ -210,21 +210,25 @@ xmlnode_get_child(xmlnode *parent, const char * xmlnode_get_data(xmlnode *node) { - GString *str; - char *ret; + GString *str = NULL; + char *ret = NULL; xmlnode *c; g_return_val_if_fail(node != NULL, NULL); - str = g_string_new(""); for(c = node->child; c; c = c->next) { - if(c->type == NODE_TYPE_DATA) + if(c->type == NODE_TYPE_DATA) { + if(!str) + str = g_string_new(""); str = g_string_append_len(str, c->data, c->data_sz); + } } - ret = str->str; - g_string_free(str, FALSE); + if(str) { + ret = str->str; + g_string_free(str, FALSE); + } return ret; } |