lib: use __attribute__((format))

see HEAD~2 for details
This commit is contained in:
Daniel Foster 2024-11-23 17:58:58 +10:00
parent d18699455b
commit 3031d571ef
No known key found for this signature in database
GPG key ID: 9A8C2923AC0ABB97
2 changed files with 6 additions and 0 deletions

View file

@ -19,6 +19,7 @@ void print_status(int errno)
vanilla_log("%s", VANILLA_STATUS_STRINGS[-errno]);
}
__attribute__((format(printf, 1, 2)))
void print_info(const char *errstr, ...)
{
va_list args;

View file

@ -113,12 +113,15 @@ void vanilla_set_touch(int x, int y)
set_touch_state(x, y);
}
__attribute__((format(printf, 1, 0)))
void default_logger(const char *format, va_list args)
{
vprintf(format, args);
}
void (*custom_logger)(const char *, va_list) = default_logger;
__attribute__((format(printf, 1, 2)))
void vanilla_log(const char *format, ...)
{
va_list va;
@ -132,6 +135,7 @@ void vanilla_log(const char *format, ...)
va_end(va);
}
__attribute__((format(printf, 1, 2)))
void vanilla_log_no_newline(const char *format, ...)
{
va_list va;
@ -142,6 +146,7 @@ void vanilla_log_no_newline(const char *format, ...)
va_end(va);
}
__attribute__((format(printf, 1, 0)))
void vanilla_log_no_newline_va(const char *format, va_list args)
{
if (custom_logger) {