aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-02 03:44:31 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-02 03:44:31 +0200
commite5b38e9312aad21210a68e0d72dd0bdfd76055bb (patch)
tree8c79b3c71c8b7797993c781ed57b3b79f0cc5c45
parent852c2ac1583ec9a7033626b93c8e894083ceaae3 (diff)
downloadxK-e5b38e9312aad21210a68e0d72dd0bdfd76055bb.tar.gz
xK-e5b38e9312aad21210a68e0d72dd0bdfd76055bb.tar.xz
xK-e5b38e9312aad21210a68e0d72dd0bdfd76055bb.zip
config: get rid of "is_nullable"
If it doesn't have a default, it just is.
-rw-r--r--common.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/common.c b/common.c
index 6210011..6320afd 100644
--- a/common.c
+++ b/common.c
@@ -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;
}