From 0cc598f1628167599131756e909630dc36d33610 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 8 Dec 2022 16:45:06 -0500 Subject: Add BFS_FORMATTER() to vprintf()-type functions too --- src/color.c | 2 ++ src/color.h | 1 + src/diag.h | 3 +++ src/dstring.h | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/color.c b/src/color.c index 8d32c6c..cc37e96 100644 --- a/src/color.c +++ b/src/color.c @@ -17,6 +17,7 @@ #include "color.h" #include "bfstd.h" #include "bftw.h" +#include "config.h" #include "dir.h" #include "dstring.h" #include "expr.h" @@ -944,6 +945,7 @@ static int print_expr(CFILE *cfile, const struct bfs_expr *expr, bool verbose) { return 0; } +BFS_FORMATTER(2, 0) static int cvbuff(CFILE *cfile, const char *format, va_list args) { const struct colors *colors = cfile->colors; int error = errno; diff --git a/src/color.h b/src/color.h index 1b0cadb..5b350cc 100644 --- a/src/color.h +++ b/src/color.h @@ -115,6 +115,7 @@ int cfprintf(CFILE *cfile, const char *format, ...); /** * cfprintf() variant that takes a va_list. */ +BFS_FORMATTER(2, 0) int cvfprintf(CFILE *cfile, const char *format, va_list args); #endif // BFS_COLOR_H diff --git a/src/diag.h b/src/diag.h index 56ad39b..8d0b19f 100644 --- a/src/diag.h +++ b/src/diag.h @@ -58,16 +58,19 @@ bool bfs_debug(const struct bfs_ctx *ctx, enum debug_flags flag, const char *for /** * bfs_error() variant that takes a va_list. */ +BFS_FORMATTER(2, 0) void bfs_verror(const struct bfs_ctx *ctx, const char *format, va_list args); /** * bfs_warning() variant that takes a va_list. */ +BFS_FORMATTER(2, 0) bool bfs_vwarning(const struct bfs_ctx *ctx, const char *format, va_list args); /** * bfs_debug() variant that takes a va_list. */ +BFS_FORMATTER(3, 0) bool bfs_vdebug(const struct bfs_ctx *ctx, enum debug_flags flag, const char *format, va_list args); /** diff --git a/src/dstring.h b/src/dstring.h index 51f1b2f..df20a04 100644 --- a/src/dstring.h +++ b/src/dstring.h @@ -152,6 +152,7 @@ char *dstrprintf(const char *format, ...); * @return * The created string, or NULL on failure. */ +BFS_FORMATTER(1, 0) char *dstrvprintf(const char *format, va_list args); /** @@ -181,6 +182,7 @@ int dstrcatf(char **str, const char *format, ...); * @return * 0 on success, -1 on failure. */ +BFS_FORMATTER(2, 0) int dstrvcatf(char **str, const char *format, va_list args); /** -- cgit v1.2.3