(hline_set_textv): new API.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2020-05-10 14:00:04 +03:00
parent d35f0c68dc
commit dffe01fab1
2 changed files with 19 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#include <config.h> #include <config.h>
#include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include "lib/global.h" #include "lib/global.h"
@ -171,3 +172,18 @@ hline_set_text (WHLine * l, const char *text)
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void
hline_set_textv (WHLine * l, const char *format, ...)
{
va_list args;
char buf[BUF_1K]; /* FIXME: is it enough? */
va_start (args, format);
g_vsnprintf (buf, sizeof (buf), format, args);
va_end (args);
hline_set_text (l, buf);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -28,6 +28,9 @@ typedef struct
WHLine *hline_new (int y, int x, int width); WHLine *hline_new (int y, int x, int width);
void hline_set_text (WHLine * l, const char *text); void hline_set_text (WHLine * l, const char *text);
/* *INDENT-OFF* */
void hline_set_textv (WHLine * l, const char *format, ...) G_GNUC_PRINTF (2, 3);
/* *INDENT-ON* */
/*** inline functions ****************************************************************************/ /*** inline functions ****************************************************************************/