summaryrefslogtreecommitdiffstats
path: root/apps/settings.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-09-04 13:17:09 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-09-04 13:17:09 +0000
commit89973217774f93f8dabcf41a559a5910b7b27f64 (patch)
tree316347c1fd4c1c0d063eead4b5e816e08f57f737 /apps/settings.c
parent060b3fa4f12b3325f29ff8303e22dd318632bd87 (diff)
downloadrockbox-89973217774f93f8dabcf41a559a5910b7b27f64.tar.gz
rockbox-89973217774f93f8dabcf41a559a5910b7b27f64.tar.bz2
rockbox-89973217774f93f8dabcf41a559a5910b7b27f64.zip
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.c14
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 )
{