summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-07-01 11:40:43 +0100
committerRichard Hughes <richard@hughsie.com>2015-07-01 11:42:54 +0100
commit46a48c4253bee029ad597e144dcf0a7a04f3c9dd (patch)
tree6af4a5a6fe1f5070e176996c8083fb6fc1e6581e
parent93213c30195ceee08cb2b722fb0f5adb302c9556 (diff)
downloadappstream-glib-46a48c4253bee029ad597e144dcf0a7a04f3c9dd.tar.gz
Only write the release timestamp if non-zero
-rw-r--r--libappstream-glib/as-release.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c
index 8ed4fb8..b39e50b 100644
--- a/libappstream-glib/as-release.c
+++ b/libappstream-glib/as-release.c
@@ -373,15 +373,18 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx)
{
AsReleasePrivate *priv = GET_PRIVATE (release);
GNode *n;
- _cleanup_free_ gchar *timestamp_str = NULL;
- timestamp_str = g_strdup_printf ("%" G_GUINT64_FORMAT,
- priv->timestamp);
n = as_node_insert (parent, "release", NULL,
AS_NODE_INSERT_FLAG_NONE,
- "timestamp", timestamp_str,
- "version", priv->version,
NULL);
+ if (priv->timestamp > 0) {
+ _cleanup_free_ gchar *timestamp_str = NULL;
+ timestamp_str = g_strdup_printf ("%" G_GUINT64_FORMAT,
+ priv->timestamp);
+ as_node_add_attribute (n, "timestamp", timestamp_str, -1);
+ }
+ if (priv->version != NULL)
+ as_node_add_attribute (n, "version", priv->version, -1);
if (as_node_context_get_version (ctx) >= 0.9) {
const gchar *tmp;
guint i;