summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-08-30 14:38:39 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-08-30 14:38:39 -0700
commite1a939ac626dda5cf97122cb650c553b2d1fcb2a (patch)
tree53021f46d4c6a407007049e7b8ab36daac7fc160 /parse.c
parent4b3bd4b739bd7a89c5dd972fff726556b219aeb2 (diff)
downloadsubsurface-e1a939ac626dda5cf97122cb650c553b2d1fcb2a.tar.gz
Move the "text" nodename hackery out of 'nodename()'
It's better to do it in the caller. Debug users may well want the full node name. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/parse.c b/parse.c
index 43bf82d86..78d84a4f4 100644
--- a/parse.c
+++ b/parse.c
@@ -210,12 +210,9 @@ static void entry(const char *name, int size, const char *buffer)
static const char *nodename(xmlNode *node, char *buf, int len)
{
- /* Don't print out the node name if it is "text" */
- if (!strcmp(node->name, "text")) {
- node = node->parent;
- if (!node || !node->name)
- return "root";
- }
+
+ if (!node || !node->name)
+ return "root";
buf += len;
*--buf = 0;
@@ -264,6 +261,10 @@ static void visit_one_node(xmlNode *node)
if (!len)
return;
+ /* Don't print out the node name if it is "text" */
+ if (!strcmp(node->name, "text"))
+ node = node->parent;
+
name = nodename(node, buffer, sizeof(buffer));
entry(name, len, content);