From da135a7fd29c065df13c3d5053d7ccc78399f28f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Filip=20Ros=C3=A9en?= Date: Wed, 12 Oct 2016 19:39:36 +0200 Subject: [PATCH] config/help: only print variable range if explicitly set Unless a module has specified their own range for a certain variable, the ranges for an integer is always [ INT_MIN, INT_MAX ], and float [ FLT_MIN, FLT_MAX ]. Printing out these ranges explicitly shall not happen unless a module has specified some other range for a variable. These changes addresses the above. Signed-off-by: Thomas Guillem --- src/config/help.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config/help.c b/src/config/help.c index 9d7e785079..16afba3deb 100644 --- a/src/config/help.c +++ b/src/config/help.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include @@ -432,7 +434,7 @@ static void print_item(const module_t *m, const module_config_t *item, module_gettext(m, item->list_text[i])); } } - else if (item->min.i != 0 || item->max.i != 0) + else if (item->min.i != INT_MIN || item->max.i != INT_MAX) { if (asprintf(&typebuf, "%s [%"PRId64" .. %"PRId64"]", type, item->min.i, item->max.i) >= 0) @@ -444,7 +446,7 @@ static void print_item(const module_t *m, const module_config_t *item, case CONFIG_ITEM_FLOAT: type = _("float"); - if (item->min.f != 0.f || item->max.f != 0.f) + if (item->min.f != FLT_MIN || item->max.f != FLT_MAX) { if (asprintf(&typebuf, "%s [%f .. %f]", type, item->min.f, item->max.f) >= 0) -- 2.11.4.GIT