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/filetypes.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/filetypes.c')
-rw-r--r-- | apps/filetypes.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c index 24dc0f2e4d..74607eac1c 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -262,9 +262,9 @@ void read_color_theme_file(void) { | |||
262 | unknown_file.color = -1; | 262 | unknown_file.color = -1; |
263 | if (!global_settings.colors_file[0] || global_settings.colors_file[0] == '-') | 263 | if (!global_settings.colors_file[0] || global_settings.colors_file[0] == '-') |
264 | return; | 264 | return; |
265 | snprintf(buffer, MAX_PATH, THEME_DIR "/%s.colours", | 265 | |
266 | global_settings.colors_file); | 266 | fd = open_pathfmt(O_RDONLY, THEME_DIR "/%s.colours", |
267 | fd = open(buffer, O_RDONLY); | 267 | global_settings.colors_file); |
268 | if (fd < 0) | 268 | if (fd < 0) |
269 | return; | 269 | return; |
270 | while (read_line(fd, buffer, MAX_PATH) > 0) | 270 | while (read_line(fd, buffer, MAX_PATH) > 0) |
@@ -303,9 +303,8 @@ void read_viewer_theme_file(void) | |||
303 | custom_filetype_icons[i] = filetypes[i].icon; | 303 | custom_filetype_icons[i] = filetypes[i].icon; |
304 | } | 304 | } |
305 | 305 | ||
306 | snprintf(buffer, MAX_PATH, "%s/%s.icons", ICON_DIR, | 306 | fd = open_pathfmt(O_RDONLY, "%s/%s.icons", ICON_DIR, |
307 | global_settings.viewers_icon_file); | 307 | global_settings.viewers_icon_file); |
308 | fd = open(buffer, O_RDONLY); | ||
309 | if (fd < 0) | 308 | if (fd < 0) |
310 | return; | 309 | return; |
311 | while (read_line(fd, buffer, MAX_PATH) > 0) | 310 | while (read_line(fd, buffer, MAX_PATH) > 0) |