Introduce win_println_va()

Previously we printed a format string into a `GString` to then print that
result again into a `GString` and display that.
This patch removes one level of `GString` printing by forwarding the
`va_arg` to the newly added API `win_println_va()`.

Introducing `static win_println_va_internal()` also allowed refactoring
most of the `win_print*()` and `win_append*()` implementations and removing
all the redundant code.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel
2023-07-27 12:24:32 +02:00
parent 84cd28c5be
commit b36562c6b6
3 changed files with 43 additions and 114 deletions

View File

@@ -393,6 +393,8 @@ void win_print(ProfWin* window, theme_item_t theme_item, const char* show_char,
void win_println(ProfWin* window, theme_item_t theme_item, const char* show_char, const char* const message, ...);
void win_println_indent(ProfWin* window, int pad, const char* const message, ...);
void win_println_va(ProfWin* window, theme_item_t theme_item, const char* show_char, const char* const message, va_list arg);
void win_append(ProfWin* window, theme_item_t theme_item, const char* const message, ...);
void win_appendln(ProfWin* window, theme_item_t theme_item, const char* const message, ...);