From d30efd5842ea15557ad34e500873a385ea711c70 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Sat, 5 Mar 2022 20:30:32 +0000 Subject: [PATCH] Update: Do not report state=set when report XML value's value is NULL --- src/reportxml.c | 2 +- src/reportxml_helper.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/reportxml.c b/src/reportxml.c index 59b035a6..b2d52f35 100644 --- a/src/reportxml.c +++ b/src/reportxml.c @@ -134,7 +134,7 @@ static const struct nodeattr __attr_relative[1] = {{"relative", "iso static const struct nodeattr __attr_name[1] = {{"name", "CDATA", NULL, 1, NULL, {NULL}}}; static const struct nodeattr __attr_member[1] = {{"member", "CDATA", NULL, 0, NULL, {NULL}}}; static const struct nodeattr __attr_value[1] = {{"value", "CDATA", NULL, 0, NULL, {NULL}}}; -static const struct nodeattr __attr_state[1] = {{"state", NULL, "set", 1, NULL, {"declared", "set", "uninitialized", "missing", NULL}}}; +static const struct nodeattr __attr_state[1] = {{"state", NULL, "set", 1, NULL, {"declared", "set", "unset", "uninitialized", "missing", NULL}}}; static const struct nodeattr __attr_href[1] = {{"href", "URI", NULL, 0, NULL, {NULL}}}; static const struct nodeattr __attr_application[1] = {{"application", "URI", NULL, 1, NULL, {NULL}}}; static const struct nodeattr __attr__action_type[1] = {{"type", NULL, NULL, 1, NULL, {"retry", "choice", "see-other", "authenticate", "pay", "change-protocol", "slow-down", "ask-user", "ask-admin", "bug", NULL}}}; diff --git a/src/reportxml_helper.c b/src/reportxml_helper.c index f5ab5132..7a490cce 100644 --- a/src/reportxml_helper.c +++ b/src/reportxml_helper.c @@ -27,7 +27,11 @@ void reportxml_helper_add_value(reportxml_node_t *parent, const char *type, cons reportxml_node_set_attribute(value, "type", type); if (member) reportxml_node_set_attribute(value, "member", member); - reportxml_node_set_attribute(value, "value", str); + if (str) { + reportxml_node_set_attribute(value, "value", str); + } else { + reportxml_node_set_attribute(value, "state", "unset"); + } reportxml_node_add_child(parent, value); refobject_unref(value); }