chiark / gitweb /
logind: filter configured cgroup controller lists
[elogind.git] / src / shared / util.h
index a8e962ea50af16365c2e9295defd275928c447da..b33fdb5b7a7f09ce090f16a3552e21a4be614104 100644 (file)
@@ -52,7 +52,7 @@ union dirent_storage {
 #define WHITESPACE " \t\n\r"
 #define NEWLINE "\n\r"
 #define QUOTES "\"\'"
-#define COMMENTS "#;\n"
+#define COMMENTS "#;"
 
 #define FORMAT_BYTES_MAX 8
 
@@ -618,6 +618,8 @@ char *strextend(char **x, ...);
 char *strrep(const char *s, unsigned n);
 
 void* greedy_realloc(void **p, size_t *allocated, size_t need);
+#define GREEDY_REALLOC(array, allocated, need) \
+        greedy_realloc((void**) &(array), &(allocated), (sizeof *array) * (need))
 
 static inline void _reset_errno_(int *saved_errno) {
         errno = *saved_errno;
@@ -655,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);                       \
+        })