diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-30 11:57:02 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-04 05:25:50 -0500 |
commit | bbe39420395618944a7174bc3d9be1bc67b257a3 (patch) | |
tree | 8e38495a2bb9da78ce53398333ee770b4b69c57c /apps/settings.c | |
parent | 0550c64226a6edfd9bc51b914fb4932840543354 (diff) | |
download | rockbox-bbe39420395618944a7174bc3d9be1bc67b257a3.tar.gz rockbox-bbe39420395618944a7174bc3d9be1bc67b257a3.zip |
settings: Settings ID to pointer for cfg_string_to_int()
Accept a pointer to struct settings_list instead of an index in the
settings array. Refactor the skin engine's touchregion_setup_setting()
to avoid the use of indices.
Change-Id: I784a5e49205da6874b8b419dd5413f722ad45b67
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/settings.c b/apps/settings.c index f166abd06f..d8e4af1460 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -232,9 +232,9 @@ void settings_load(int which) } } -bool cfg_string_to_int(int setting_id, int* out, const char* str) +bool cfg_string_to_int(const struct settings_list *setting, int* out, const char* str) { - const char* start = settings[setting_id].cfg_vals; + const char* start = setting->cfg_vals; char* end = NULL; char temp[MAX_PATH]; int count = 0; @@ -353,7 +353,7 @@ bool settings_load_config(const char* file, bool apply) else { int temp, *v = (int*)setting->setting; - bool found = cfg_string_to_int(index, &temp, value); + bool found = cfg_string_to_int(setting, &temp, value); if (found) { if (setting->flags & F_TABLE_SETTING) @@ -370,7 +370,7 @@ bool settings_load_config(const char* file, bool apply) case F_T_BOOL: { int temp; - if (cfg_string_to_int(index, &temp, value)) + if (cfg_string_to_int(setting, &temp, value)) *(bool*)setting->setting = !!temp; if (setting->bool_setting->option_callback) setting->bool_setting->option_callback(!!temp); |