summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2018-05-21 16:40:07 +0100
committerRichard Hughes <richard@hughsie.com>2018-05-21 17:15:10 +0100
commit72ab99a8df88ea51e195ee498dc70541fc5b2142 (patch)
tree397b71b06c3c9ab547fe74b7325adeffca1b1e31
parent7eb2b84983cce310788087a811df828c1c9b9147 (diff)
downloadappstream-glib-72ab99a8df88ea51e195ee498dc70541fc5b2142.tar.gz
trivial: Do less strcmp'ing when not keeping comments
-rw-r--r--libappstream-glib/as-node.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c
index 945c465..72e906b 100644
--- a/libappstream-glib/as-node.c
+++ b/libappstream-glib/as-node.c
@@ -607,7 +607,6 @@ as_node_start_element_cb (GMarkupParseContext *context,
AsNodeData *data;
AsNodeData *data_parent;
AsNode *current;
- AsRefString *tmp;
guint i;
/* check if we should ignore the locale */
@@ -648,10 +647,13 @@ as_node_start_element_cb (GMarkupParseContext *context,
current = g_node_append_data (helper->current, data);
/* transfer the ownership of the comment to the new child */
- tmp = as_node_get_attribute_as_refstr (helper->current, "@comment-tmp");
- if (tmp != NULL) {
- as_node_add_attribute (current, "@comment", tmp);
- as_node_remove_attribute (helper->current, "@comment-tmp");
+ if (helper->flags & AS_NODE_FROM_XML_FLAG_KEEP_COMMENTS) {
+ AsRefString *tmp;
+ tmp = as_node_get_attribute_as_refstr (helper->current, "@comment-tmp");
+ if (tmp != NULL) {
+ as_node_add_attribute (current, "@comment", tmp);
+ as_node_remove_attribute (helper->current, "@comment-tmp");
+ }
}
/* the child is now the node to be processed */