degesch: mark all unrecognized config values

This commit is contained in:
Přemysl Eric Janouch 2015-07-05 18:26:46 +02:00
parent ff20e74868
commit 15d3129ea3
1 changed files with 12 additions and 12 deletions

View File

@ -6223,27 +6223,27 @@ config_dump_item (struct config_item_ *item, struct config_dump_data *data)
for (; iter; iter = iter->next)
str_append_printf (&line, ".%s", iter->name);
struct str value;
str_init (&value);
config_item_write (item, false, &value);
// Don't bother writing out null values everywhere
struct config_schema *schema = item->schema;
bool has_default = schema && schema->default_;
if (item->type != CONFIG_ITEM_NULL || has_default)
{
str_append (&line, " = ");
struct str value;
str_init (&value);
config_item_write (item, false, &value);
str_append_str (&line, &value);
if (!schema)
str_append (&line, " (unrecognized)");
else if (has_default && strcmp (schema->default_, value.str))
str_append_printf (&line, " (default: %s)", schema->default_);
else if (!has_default && item->type != CONFIG_ITEM_NULL)
str_append_printf (&line, " (default: %s)", "null");
str_free (&value);
}
if (!schema)
str_append (&line, " (unrecognized)");
else if (has_default && strcmp (schema->default_, value.str))
str_append_printf (&line, " (default: %s)", schema->default_);
else if (!has_default && item->type != CONFIG_ITEM_NULL)
str_append_printf (&line, " (default: %s)", "null");
str_free (&value);
str_vector_add_owned (data->output, str_steal (&line));
}