summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-08-20 16:47:44 +0000
committerNils Wallménius <nils@rockbox.org>2009-08-20 16:47:44 +0000
commit3200d04d75c5e7556ed8880b155533e881a4d1e1 (patch)
tree188e2c9525b25cb8922a14766e51ab02bad3f831 /apps/settings.c
parent0a1728444882cdbc6a0c815bd88464de25ad94e9 (diff)
Make the formatter functions used by the settings return a pointer to avoid usless copying of lang strings, this brought with it a long chain of const correctness and a few random cleanups
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22440 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/settings.c b/apps/settings.c
index b76468280e..98cd6ebc95 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1083,7 +1083,7 @@ bool set_int(const unsigned char* string,
int step,
int min,
int max,
- void (*formatter)(char*, size_t, int, const char*) )
+ const char* (*formatter)(char*, size_t, int, const char*) )
{
return set_int_ex(string, unit, voice_unit, variable, function,
step, min, max, formatter, NULL);
@@ -1097,7 +1097,7 @@ bool set_int_ex(const unsigned char* string,
int step,
int min,
int max,
- void (*formatter)(char*, size_t, int, const char*),
+ const char* (*formatter)(char*, size_t, int, const char*),
int32_t (*get_talk_id)(int, int))
{
(void)unit;
@@ -1117,17 +1117,18 @@ bool set_int_ex(const unsigned char* string,
static const struct opt_items *set_option_options;
-static void set_option_formatter(char* buf, size_t size, int item, const char* unit)
+static const char* set_option_formatter(char* buf, size_t size, int item, const char* unit)
{
- (void)unit;
- const unsigned char *text = set_option_options[item].string;
- strlcpy(buf, P2STR(text), size);
+ (void)buf, (void)unit, (void)size;
+ return P2STR(set_option_options[item].string);
}
+
static int32_t set_option_get_talk_id(int value, int unit)
{
(void)unit;
return set_option_options[value].voice_id;
}
+
bool set_option(const char* string, const void* variable, enum optiontype type,
const struct opt_items* options,
int numoptions, void (*function)(int))