From 39a8ef05cdbb44758752bbe491b895672ce0e811 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sun, 28 Apr 2024 15:59:36 +0800 Subject: [PATCH] various: drop unnecessary DISABLE_WARNING_FORMAT_NONLITERAL We use _printf_ for these functions, so there shouldn't be a warning in the first place. --- src/basic/stdio-util.h | 4 +--- src/shared/ptyfwd.c | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h index 4e93ac90c9a..0a2239d0225 100644 --- a/src/basic/stdio-util.h +++ b/src/basic/stdio-util.h @@ -9,14 +9,12 @@ #include "macro.h" _printf_(3, 4) -static inline char *snprintf_ok(char *buf, size_t len, const char *format, ...) { +static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) { va_list ap; int r; va_start(ap, format); - DISABLE_WARNING_FORMAT_NONLITERAL; r = vsnprintf(buf, len, format, ap); - REENABLE_WARNING; va_end(ap); return r >= 0 && (size_t) r < len ? buf : NULL; diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index 7bd8dd6d898..897e39c5338 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -1084,9 +1084,7 @@ int pty_forward_set_titlef(PTYForward *f, const char *format, ...) { return -EBUSY; va_start(ap, format); - DISABLE_WARNING_FORMAT_NONLITERAL; r = vasprintf(&title, format, ap); - REENABLE_WARNING; va_end(ap); if (r < 0) return -ENOMEM; -- 2.47.3