summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-14 17:43:59 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-14 17:43:59 +0200
commited5c5dbde1575d74c87ae9856fe61268d7ae8f4b (patch)
treef9cf03c29268df9b37e7f1cfd455752f8ef3ca74 /src/shared/util.h
parent01f6c9d4685edbc38c8df9175286f0e312dc1938 (diff)
util: introduce alloca0() and use it at a number of places
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index ad9753655a..b33fdb5b7a 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -657,3 +657,11 @@ static inline unsigned decimal_str_max(unsigned x) {
}
int unlink_noerrno(const char *path);
+
+#define alloca0(n) \
+ ({ \
+ char *__new; \
+ size_t __len = n; \
+ __new = alloca(__len); \
+ (void *) memset(__new, 0, __len); \
+ })