summaryrefslogtreecommitdiffstats
path: root/include/xalloc.h
diff options
context:
space:
mode:
authorSami Kerola2012-07-25 21:15:34 +0200
committerKarel Zak2012-07-26 13:51:24 +0200
commitd0aa8a446deaabfcc162a7af97ab24e6bd8440bc (patch)
treef3b1192e4b2e54fa98839a52eee5b6ec00eea6c9 /include/xalloc.h
parenthexdump: fix shadow declaration (diff)
downloadkernel-qcow2-util-linux-d0aa8a446deaabfcc162a7af97ab24e6bd8440bc.tar.gz
kernel-qcow2-util-linux-d0aa8a446deaabfcc162a7af97ab24e6bd8440bc.tar.xz
kernel-qcow2-util-linux-d0aa8a446deaabfcc162a7af97ab24e6bd8440bc.zip
include: define format to be constant in xasprintf()
Add also format function attribute to add robustness. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'include/xalloc.h')
-rw-r--r--include/xalloc.h3
1 files changed, 2 insertions, 1 deletions
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;