From e7e20fab1b2b90ea80e118959386017ed1d6f703 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 19 Nov 2022 22:39:14 -0500 Subject: 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 --- apps/debug_menu.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'apps/debug_menu.c') 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) static bool cpu_boost_log_dump(void) { int fd; -#if CONFIG_RTC - struct tm *nowtm; - char fname[MAX_PATH]; -#endif - int count = cpu_boost_log_getcount(); char *str = cpu_boost_log_getlog_first(); @@ -2312,11 +2307,11 @@ static bool cpu_boost_log_dump(void) return false; #if CONFIG_RTC - nowtm = get_time(); - snprintf(fname, MAX_PATH, "%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR, - nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday, - nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec); - fd = open(fname, O_CREAT|O_WRONLY|O_TRUNC); + struct tm *nowtm = get_time(); + fd = open_pathfmt(O_CREAT|O_WRONLY|O_TRUNC, + "%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR, + nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday, + nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec); #else fd = open(ROCKBOX_DIR "/boostlog.txt", O_CREAT|O_WRONLY|O_TRUNC, 0666); #endif -- cgit v1.2.3