diff th_string.h @ 570:262411458cde

Add __attribute__(__format__ ..) specifiers for functions that use printf() style format specifiers.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Jan 2020 13:36:41 +0200
parents ccff3eb8dbb6
children 70d44ba005ac
line wrap: on
line diff
--- a/th_string.h	Wed Jan 08 02:36:42 2020 +0200
+++ b/th_string.h	Thu Jan 09 13:36:41 2020 +0200
@@ -104,16 +104,20 @@
 void    th_strip_ctrlchars(char *str);
 
 int     th_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap);
-int     th_snprintf(char *buf, size_t size, const char *fmt, ...);
+int     th_snprintf(char *buf, size_t size, const char *fmt, ...)
+        __attribute__ ((__format__ (__printf__, 3, 4)));
 int     th_vfprintf(FILE *fh, const char *fmt, va_list ap);
-int     th_fprintf(FILE *fh, const char *fmt, ...);
+int     th_fprintf(FILE *fh, const char *fmt, ...)
+        __attribute__ ((__format__ (__printf__, 2, 3)));
 
 
 char    *th_strdup_vprintf(const char *fmt, va_list ap);
-char    *th_strdup_printf(const char *fmt, ...);
+char    *th_strdup_printf(const char *fmt, ...)
+        __attribute__ ((__format__ (__printf__, 1, 2)));
 
 void    th_pstr_vprintf(char **buf, const char *fmt, va_list ap);
-void    th_pstr_printf(char **buf, const char *fmt, ...);
+void    th_pstr_printf(char **buf, const char *fmt, ...)
+        __attribute__ ((__format__ (__printf__, 2, 3)));
 
 int     th_pstr_cpy(char **pdst, const char *src);
 int     th_pstr_cat(char **pdst, const char *src);