Do not try to convert to true/false, as it breaks integer vars

See discussion at https://github.com/radareorg/radare2/pull/15681 .
Unfortunately the change cannot be done for non-int vars only, because
right now vars are not statically typed, so a var that is initially
CN_INT can then become CN_STR if you set a string.

Changing vars to assign them a static type when they are created would
require a much bigger change and discussion.
This commit is contained in:
Riccardo Schirone 2020-01-16 15:06:18 +01:00 committed by radare
parent 8a330bedb0
commit d8f2b4a4db

View File

@ -417,22 +417,15 @@ R_API RConfigNode* r_config_set(RConfig *cfg, const char *name, const char *valu
goto beach;
}
free (node->value);
if (r_str_is_false (value)) {
node->value = strdup ("false");
node->i_value = 0;
} else if (r_str_is_true (value)) {
node->value = strdup ("true");
node->i_value = 1;
} else {
node->value = strdup (value);
node->i_value = 2;
}
node->value = strdup (value);
if (IS_DIGIT (*value) || (value[0] == '-' && IS_DIGIT (value[1]))) {
if (strchr (value, '/')) {
node->i_value = r_num_get (cfg->num, value);
} else {
node->i_value = r_num_math (cfg->num, value);
}
} else {
node->i_value = 0;
}
node->flags |= CN_INT;
}