comparison src/xmlnode.c @ 11390:869cef00a947

[gaim-migrate @ 13618] make this a little safer committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 31 Aug 2005 18:37:10 +0000
parents 98de05966d6d
children 0906a3e9626c
comparison
equal deleted inserted replaced
11389:098cfd8152bc 11390:869cef00a947
403 403
404 404
405 xmlnode * 405 xmlnode *
406 xmlnode_from_str(const char *str, gssize size) 406 xmlnode_from_str(const char *str, gssize size)
407 { 407 {
408 struct _xmlnode_parser_data *xpd = g_new0(struct _xmlnode_parser_data, 1); 408 struct _xmlnode_parser_data *xpd;
409 xmlnode *ret; 409 xmlnode *ret;
410 GMarkupParseContext *context; 410 GMarkupParseContext *context;
411 gsize real_size = size == -1 ? strlen(str) : size; 411 gsize real_size;
412 412
413 g_return_val_if_fail(str != NULL, NULL);
414
415 real_size = size == -1 ? strlen(str) : size;
416 xpd = g_new0(struct _xmlnode_parser_data, 1);
413 context = g_markup_parse_context_new(&xmlnode_parser, 0, xpd, NULL); 417 context = g_markup_parse_context_new(&xmlnode_parser, 0, xpd, NULL);
414 418
415 if(!g_markup_parse_context_parse(context, str, real_size, NULL)) { 419 if(!g_markup_parse_context_parse(context, str, real_size, NULL)) {
416 while(xpd->current && xpd->current->parent) 420 while(xpd->current && xpd->current->parent)
417 xpd->current = xpd->current->parent; 421 xpd->current = xpd->current->parent;