Mercurial > pidgin.yaz
changeset 9838:ad7fab671e6f
[gaim-migrate @ 10715]
this is a little cleaner
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 23 Aug 2004 05:17:59 +0000 |
parents | dafebadcf8d2 |
children | 96e98bb4ded5 |
files | src/xmlnode.c |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xmlnode.c Mon Aug 23 05:06:38 2004 +0000 +++ b/src/xmlnode.c Mon Aug 23 05:17:59 2004 +0000 @@ -246,13 +246,13 @@ return ret; } -static char *xmlnode_to_str_helper(xmlnode *node, int *len, gboolean pretty, int depth) +static char *xmlnode_to_str_helper(xmlnode *node, int *len, gboolean formatting, int depth) { char *ret; GString *text = g_string_new(""); xmlnode *c; char *node_name, *esc, *esc2, *tab = NULL; - gboolean need_end = FALSE, has_data = FALSE; + gboolean need_end = FALSE, pretty = formatting; #ifdef _WIN32 static const char *newline = "\r\n"; #else @@ -277,19 +277,19 @@ g_free(esc2); } else if(c->type == XMLNODE_TYPE_TAG || c->type == XMLNODE_TYPE_DATA) { if(c->type == XMLNODE_TYPE_DATA) - has_data = TRUE; + pretty = FALSE; need_end = TRUE; } } if(need_end) { - g_string_append_printf(text, ">%s", (pretty && !has_data) ? newline : ""); + g_string_append_printf(text, ">%s", pretty ? newline : ""); for(c = node->child; c; c = c->next) { if(c->type == XMLNODE_TYPE_TAG) { int esc_len; - esc = xmlnode_to_str_helper(c, &esc_len, (pretty && !has_data), depth+1); + esc = xmlnode_to_str_helper(c, &esc_len, pretty, depth+1); text = g_string_append_len(text, esc, esc_len); g_free(esc); } else if(c->type == XMLNODE_TYPE_DATA) { @@ -299,7 +299,7 @@ } } - if(tab && pretty && !has_data) + if(tab && pretty) text = g_string_append(text, tab); g_string_append_printf(text, "</%s>%s", node_name, pretty ? newline : ""); } else {