summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-11-19 22:39:14 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-11-19 23:13:42 -0500
commite7e20fab1b2b90ea80e118959386017ed1d6f703 (patch)
treedf435e8bc4a4d9069a365061454443ae9e33ded3 /apps/debug_menu.c
parent8fe42c43c6c62a8f593ee337902f8919ed2152ad (diff)
downloadrockbox-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/debug_menu.c')
-rw-r--r--apps/debug_menu.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 5ebaa3a3f4..a4bfe65b1c 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -2297,11 +2297,6 @@ static bool cpu_boost_log(void)
2297static bool cpu_boost_log_dump(void) 2297static bool cpu_boost_log_dump(void)
2298{ 2298{
2299 int fd; 2299 int fd;
2300#if CONFIG_RTC
2301 struct tm *nowtm;
2302 char fname[MAX_PATH];
2303#endif
2304
2305 int count = cpu_boost_log_getcount(); 2300 int count = cpu_boost_log_getcount();
2306 char *str = cpu_boost_log_getlog_first(); 2301 char *str = cpu_boost_log_getlog_first();
2307 2302
@@ -2312,11 +2307,11 @@ static bool cpu_boost_log_dump(void)
2312 return false; 2307 return false;
2313 2308
2314#if CONFIG_RTC 2309#if CONFIG_RTC
2315 nowtm = get_time(); 2310 struct tm *nowtm = get_time();
2316 snprintf(fname, MAX_PATH, "%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR, 2311 fd = open_pathfmt(O_CREAT|O_WRONLY|O_TRUNC,
2317 nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday, 2312 "%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR,
2318 nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec); 2313 nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday,
2319 fd = open(fname, O_CREAT|O_WRONLY|O_TRUNC); 2314 nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec);
2320#else 2315#else
2321 fd = open(ROCKBOX_DIR "/boostlog.txt", O_CREAT|O_WRONLY|O_TRUNC, 0666); 2316 fd = open(ROCKBOX_DIR "/boostlog.txt", O_CREAT|O_WRONLY|O_TRUNC, 0666);
2322#endif 2317#endif