config: get rid of "is_nullable"

If it doesn't have a default, it just is.
This commit is contained in:
Přemysl Eric Janouch 2015-05-02 03:44:31 +02:00
parent 852c2ac158
commit e5b38e9312
1 changed files with 3 additions and 4 deletions

View File

@ -550,11 +550,10 @@ struct config_schema
const char *comment; ///< User-readable description
enum config_item_type type; ///< Required type
bool is_nullable; ///< Can be null?
const char *default_; ///< Default as a configuration snippet
/// Check if the new value can be accepted.
/// If this is not defined, only "type" and "is_nullable" is considered.
/// If this is not defined, only "type" and having a default is considered.
bool (*validate) (struct config_item_ *, const struct config_item_ *);
/// The value has changed. Only appliable to objects.
@ -696,7 +695,7 @@ config_schema_accepts_type
if (config_item_type_is_string (self->type)
&& config_item_type_is_string (type))
return true;
return self->is_nullable && type == CONFIG_ITEM_NULL;
return !self->default_ && type == CONFIG_ITEM_NULL;
}
@ -717,7 +716,7 @@ config_item_set_from (struct config_item_ *self, struct config_item_ *source,
{
error_set (e, "invalid type of value, expected: %s%s",
config_item_type_name (schema->type),
schema->is_nullable ? " (or null)" : "");
!schema->default_ ? " (or null)" : "");
return false;
}