diff options
| author | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-05 18:26:46 +0200 | 
|---|---|---|
| committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-05 18:26:46 +0200 | 
| commit | 15d3129ea3876e23d3b8dafc68463cfdbd5ada42 (patch) | |
| tree | ed7f0172cd86958e524caa699e032acc017fdb42 | |
| parent | ff20e748683ef98a98b47c481aa620e95499e50c (diff) | |
| download | xK-15d3129ea3876e23d3b8dafc68463cfdbd5ada42.tar.gz xK-15d3129ea3876e23d3b8dafc68463cfdbd5ada42.tar.xz xK-15d3129ea3876e23d3b8dafc68463cfdbd5ada42.zip  | |
degesch: mark all unrecognized config values
| -rw-r--r-- | degesch.c | 24 | 
1 files changed, 12 insertions, 12 deletions
@@ -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));  }  | 
