Some minor improvements

* destroy/free/shutdown/close in reverse order of allocation
* more static/auto_Xfree
* less variables/strlen/GString
* properly `\0`-terminate string of testcase

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel
2025-03-07 11:51:30 +01:00
parent b55bf6e4bd
commit 72b99ceb6d
9 changed files with 21 additions and 32 deletions

View File

@@ -160,12 +160,11 @@ cons_bad_cmd_usage(const char* const cmd)
void
cons_show_error(const char* const msg, ...)
{
ProfWin* console = wins_get_console();
va_list arg;
va_start(arg, msg);
GString* fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, msg, arg);
win_println(console, THEME_ERROR, "-", "%s", fmt_msg->str);
win_println(wins_get_console(), THEME_ERROR, "-", "%s", fmt_msg->str);
g_string_free(fmt_msg, TRUE);
va_end(arg);

View File

@@ -93,7 +93,6 @@ static void
_ui_close(void)
{
g_timer_destroy(ui_idle_time);
endwin();
notifier_uninit();
cons_clear_alerts();
wins_destroy();
@@ -102,6 +101,7 @@ _ui_close(void)
free_title_bar();
delwin(main_scr);
delscreen(set_term(NULL));
endwin();
}
void