[PATCH 32/34] printf format attributes and format string constness in error helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tommi Rantala <tommi.t.rantala@xxxxxxxxx>
---
 src/include/error.h | 16 ++++++++--------
 src/lib/error.c     | 16 ++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/include/error.h b/src/include/error.h
index 4acff49..29999fe 100644
--- a/src/include/error.h
+++ b/src/include/error.h
@@ -6,14 +6,14 @@
 #include <stdarg.h>
 #include <string.h>
 
-void err_exit(int err, char *fmt, ...) __attribute__((noreturn));
-void err_msg(char *fmt, ...);
-void err_msg_n(int err, char *fmt, ...);
-void err_quit(char *fmt, ...) __attribute__((noreturn));
-void debug(char *fmt, ...);
-void info(char *fmt, ...);
-void warn(char *fmt, ...);
-void fatal(char *fmt, ...) __attribute__((noreturn));
+void err_exit(int err, const char *fmt, ...) __attribute__((noreturn)) __attribute__((format (printf, 2, 3)));
+void err_msg(const char *fmt, ...)__attribute__((format (printf, 1, 2)));
+void err_msg_n(int err, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
+void err_quit(const char *fmt, ...) __attribute__((noreturn)) __attribute__((format (printf, 1, 2)));
+void debug(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+void info(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+void warn(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+void fatal(const char *fmt, ...) __attribute__((noreturn)) __attribute__((format (printf, 1, 2)));
 void err_doit(int err, const char *fmt, va_list ap);
 
 #endif	/* __ERROR_H */
diff --git a/src/lib/error.c b/src/lib/error.c
index b32aa02..d10bbce 100644
--- a/src/lib/error.c
+++ b/src/lib/error.c
@@ -7,7 +7,7 @@
 #include "error.h"
 
 /* Print an error message, plus a message for err and exit with error err */
-void err_exit(int err, char *fmt, ...)
+void err_exit(int err, const char *fmt, ...)
 {
 	va_list ap;
 	va_start(ap, fmt);
@@ -17,7 +17,7 @@ void err_exit(int err, char *fmt, ...)
 }
 
 /* print an error message and return */
-void err_msg(char *fmt, ...)
+void err_msg(const char *fmt, ...)
 {
 	va_list ap;
 	va_start(ap, fmt);
@@ -27,7 +27,7 @@ void err_msg(char *fmt, ...)
 }
 
 /* Print an error message, plus a message for err, and return */
-void err_msg_n(int err, char *fmt, ...)
+void err_msg_n(int err, const char *fmt, ...)
 {
 	va_list ap;
 	va_start(ap, fmt);
@@ -37,7 +37,7 @@ void err_msg_n(int err, char *fmt, ...)
 }
 
 /* print an error message and quit */
-void err_quit(char *fmt, ...)
+void err_quit(const char *fmt, ...)
 {
 	va_list ap;
 	va_start(ap, fmt);
@@ -46,7 +46,7 @@ void err_quit(char *fmt, ...)
 	exit(1);
 }
 
-void debug(char *fmt, ...)
+void debug(const char *fmt, ...)
 {
 	va_list ap;
 
@@ -56,7 +56,7 @@ void debug(char *fmt, ...)
 	va_end(ap);
 }
 
-void info(char *fmt, ...)
+void info(const char *fmt, ...)
 {
 	va_list ap;
 
@@ -66,7 +66,7 @@ void info(char *fmt, ...)
 	va_end(ap);
 }
 
-void warn(char *fmt, ...)
+void warn(const char *fmt, ...)
 {
 	va_list ap;
 
@@ -76,7 +76,7 @@ void warn(char *fmt, ...)
 	va_end(ap);
 }
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
 	va_list ap;
 
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux