From 3200d04d75c5e7556ed8880b155533e881a4d1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Wallm=C3=A9nius?= Date: Thu, 20 Aug 2009 16:47:44 +0000 Subject: 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 --- apps/settings.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'apps/settings.c') 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)) -- cgit v1.2.3