diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-04 13:17:09 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-04 13:17:09 +0000 |
commit | 89973217774f93f8dabcf41a559a5910b7b27f64 (patch) | |
tree | 316347c1fd4c1c0d063eead4b5e816e08f57f737 /apps/settings.c | |
parent | 060b3fa4f12b3325f29ff8303e22dd318632bd87 (diff) |
Remove duplicated code to search for a setting by its cfg name
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30428 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/settings.c b/apps/settings.c index 623bc5b2a0..258facee38 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1087,6 +1087,20 @@ const struct settings_list* find_setting(const void* variable, int *id) } return NULL; } +const struct settings_list* find_setting_by_cfgname(const char* name, int *id) +{ + int i; + for (i=0; i<nb_settings; i++) + { + if (settings[i].cfg_name && + !strcmp(settings[i].cfg_name, name)) + { + if (id) *id = i; + return &settings[i]; + } + } + return NULL; +} bool set_bool(const char* string, const bool* variable ) { |