char *p, *str = strdup(s->value);
const char *value = s->value;
- if (!str || !nargs)
+ if (!str || !nargs) {
+ free(str);
return false;
+ }
for (p = strtok(str, " \t"); p; p = strtok(NULL, " \t"))
{
static bool
dt_type_min(struct dt_state *s, int nargs)
{
- int n, min;
+ int n;
+ int min = 0;
char *e;
if (dt_getint(0, min))
static bool
dt_type_max(struct dt_state *s, int nargs)
{
- int n, max;
+ int n;
+ int max = 0;
char *e;
if (dt_getint(0, max))
static bool
dt_type_range(struct dt_state *s, int nargs)
{
- int n, min, max;
+ int n;
+ int min = 0;
+ int max = 0;
char *e;
if (dt_getint(0, min) && dt_getint(1, max))
static bool
dt_type_minlen(struct dt_state *s, int nargs)
{
- int min;
+ int min = 0;
if (dt_getint(0, min))
return (strlen(s->value) >= min);
static bool
dt_type_maxlen(struct dt_state *s, int nargs)
{
- int max;
+ int max = 0;
if (dt_getint(0, max))
return (strlen(s->value) <= max);
static bool
dt_type_rangelen(struct dt_state *s, int nargs)
{
- int min, max;
+ int min = 0;
+ int max = 0;
int len = strlen(s->value);
if (dt_getint(0, min) && dt_getint(1, max))
{
int i;
const char *values[] = {
- "0", "off", "false", "no",
- "1", "on", "true", "yes"
+ "0", "off", "false", "no", "disabled",
+ "1", "on", "true", "yes", "enabled"
};
for (i = 0; i < sizeof(values) / sizeof(values[0]); i++)
static bool
dt_type_string(struct dt_state *s, int nargs)
{
- int min, max;
+ int min = 0;
+ int max = 0;
int len = strlen(s->value);
if (dt_getint(0, min) && (len < min))
static bool
dt_type_hexstring(struct dt_state *s, int nargs)
{
- int min, max;
+ int min = 0;
+ int max = 0;
int len = strlen(s->value);
const char *p;