From d0aa8a446deaabfcc162a7af97ab24e6bd8440bc Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 25 Jul 2012 21:15:34 +0200 Subject: include: define format to be constant in xasprintf() Add also format function attribute to add robustness. Signed-off-by: Sami Kerola --- include/xalloc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/xalloc.h') diff --git a/include/xalloc.h b/include/xalloc.h index 8c22ff76a..1704259bc 100644 --- a/include/xalloc.h +++ b/include/xalloc.h @@ -63,7 +63,8 @@ static inline char *xstrdup(const char *str) return ret; } -static inline int xasprintf(char **strp, char *fmt, ...) +static inline int __attribute__ ((__format__(printf, 2, 3))) + xasprintf(char **strp, const char *fmt, ...) { int ret; va_list args; -- cgit v1.2.3-55-g7522