1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
William Wilgus 2022-11-19 22:39:14 -05:00 committed by William Wilgus
parent 8fe42c43c6
commit e7e20fab1b
8 changed files with 42 additions and 53 deletions

View file

@ -247,7 +247,6 @@ static struct buflib_callbacks talk_ops = {
static int open_voicefile(void)
{
char buf[64];
char* p_lang = DEFAULT_VOICE_LANG; /* default */
if ( global_settings.lang_file[0] &&
@ -256,9 +255,7 @@ static int open_voicefile(void)
p_lang = (char *)global_settings.lang_file;
}
snprintf(buf, sizeof(buf), LANG_DIR "/%s.voice", p_lang);
return open(buf, O_RDONLY);
return open_pathfmt(O_RDONLY, LANG_DIR "/%s.voice", p_lang);
}