diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-19 22:39:14 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-11-19 23:13:42 -0500 |
commit | e7e20fab1b2b90ea80e118959386017ed1d6f703 (patch) | |
tree | df435e8bc4a4d9069a365061454443ae9e33ded3 /apps/talk.c | |
parent | 8fe42c43c6c62a8f593ee337902f8919ed2152ad (diff) | |
download | rockbox-e7e20fab1b2b90ea80e118959386017ed1d6f703.tar.gz rockbox-e7e20fab1b2b90ea80e118959386017ed1d6f703.zip |
create function open_pathfmt() to allow printf formatting on open()
save some space by allowing printf formatting directly rather than
having a buffer and using sprintf
Change-Id: I049c8f898fb4a68a26ad0f0646250c242647ba12
Diffstat (limited to 'apps/talk.c')
-rw-r--r-- | apps/talk.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/apps/talk.c b/apps/talk.c index 8507a89541..89319ae9a2 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -247,7 +247,6 @@ static struct buflib_callbacks talk_ops = { | |||
247 | 247 | ||
248 | static int open_voicefile(void) | 248 | static int open_voicefile(void) |
249 | { | 249 | { |
250 | char buf[64]; | ||
251 | char* p_lang = DEFAULT_VOICE_LANG; /* default */ | 250 | char* p_lang = DEFAULT_VOICE_LANG; /* default */ |
252 | 251 | ||
253 | if ( global_settings.lang_file[0] && | 252 | if ( global_settings.lang_file[0] && |
@@ -256,9 +255,7 @@ static int open_voicefile(void) | |||
256 | p_lang = (char *)global_settings.lang_file; | 255 | p_lang = (char *)global_settings.lang_file; |
257 | } | 256 | } |
258 | 257 | ||
259 | snprintf(buf, sizeof(buf), LANG_DIR "/%s.voice", p_lang); | 258 | return open_pathfmt(O_RDONLY, LANG_DIR "/%s.voice", p_lang); |
260 | |||
261 | return open(buf, O_RDONLY); | ||
262 | } | 259 | } |
263 | 260 | ||
264 | 261 | ||