]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include: define format to be constant in xasprintf()
authorSami Kerola <kerolasa@iki.fi>
Wed, 25 Jul 2012 19:15:34 +0000 (21:15 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 26 Jul 2012 11:51:24 +0000 (13:51 +0200)
Add also format function attribute to add robustness.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
include/xalloc.h

index 8c22ff76a9906b52914eed7c4667175dc259b335..1704259bca804a2bfcbca5026503457dfb1c52ea 100644 (file)
@@ -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;