summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/til_settings.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/til_settings.c b/src/til_settings.c
index 71aefb4..4749372 100644
--- a/src/til_settings.c
+++ b/src/til_settings.c
@@ -431,18 +431,28 @@ til_setting_desc_t * til_setting_desc_free(const til_setting_desc_t *desc)
}
+/* TODO: spec checking in general needs refinement and to be less intolerant of
+ * creative experimentation.
+ */
int til_setting_spec_check(const til_setting_spec_t *spec, const char *value)
{
assert(spec);
assert(value);
- if (spec->values) {
+ /* XXX: this check can't really be performed on anything but "leaf" settings. */
+ if (spec->values && !spec->as_nested_settings) {
for (int i = 0; spec->values[i]; i++) {
if (!strcasecmp(spec->values[i], value))
return 0;
}
+ /* TODO: there probably needs to be a way to make this less fatal
+ * in the spec and/or at runtime via a flag. The values[] are more like presets,
+ * and especially for numeric settings we should be able to explicitly specify a
+ * perfectly usable number that isn't within the presets, if the module can live
+ * with it (think arbitrary floats)...
+ */
return -EINVAL;
}
© All Rights Reserved