From e5b38e9312aad21210a68e0d72dd0bdfd76055bb Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sat, 2 May 2015 03:44:31 +0200
Subject: config: get rid of "is_nullable"
If it doesn't have a default, it just is.
---
common.c | 7 +++----
1 file 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;
}
--
cgit v1.2.3-70-g09d2