mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 04:28:04 +00:00
Simplify config_get_bool
This commit is contained in:
parent
48f2612223
commit
54dfaaa3bc
@ -1000,21 +1000,29 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in)
|
|||||||
{
|
{
|
||||||
const struct config_entry_list *entry = config_get_entry(conf, key, NULL);
|
const struct config_entry_list *entry = config_get_entry(conf, key, NULL);
|
||||||
|
|
||||||
if (entry)
|
if (!entry)
|
||||||
{
|
return false;
|
||||||
if (string_is_equal(entry->value, "true"))
|
|
||||||
*in = true;
|
|
||||||
else if (string_is_equal(entry->value, "1"))
|
|
||||||
*in = true;
|
|
||||||
else if (string_is_equal(entry->value, "false"))
|
|
||||||
*in = false;
|
|
||||||
else if (string_is_equal(entry->value, "0"))
|
|
||||||
*in = false;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return entry != NULL;
|
if (
|
||||||
|
(
|
||||||
|
entry->value[0] == '1'
|
||||||
|
&& entry->value[1] == '\0'
|
||||||
|
)
|
||||||
|
|| string_is_equal(entry->value, "true")
|
||||||
|
)
|
||||||
|
*in = true;
|
||||||
|
else if (
|
||||||
|
(
|
||||||
|
entry->value[0] == '0'
|
||||||
|
&& entry->value[1] == '\0'
|
||||||
|
)
|
||||||
|
|| string_is_equal(entry->value, "false")
|
||||||
|
)
|
||||||
|
*in = false;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_set_string(config_file_t *conf, const char *key, const char *val)
|
void config_set_string(config_file_t *conf, const char *key, const char *val)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user