chiark / gitweb /
move _cleanup_ attribute in front of the type
[elogind.git] / src / shared / util.h
index 3aac165e67d0792f11857bb1f830783bf1ab2f36..cfb54939cd5d21730b4adcc3cf96a915a9dd58d8 100644 (file)
@@ -684,3 +684,15 @@ int unlink_noerrno(const char *path);
                 _new_ = alloca(_len_);                  \
                 (void *) memset(_new_, 0, _len_);       \
         })
+
+#define strappenda(a, b)                                \
+        ({                                              \
+                const char *_a_ = (a), *_b_ = (b);      \
+                char *_c_;                              \
+                size_t _x_, _y_;                        \
+                _x_ = strlen(_a_);                      \
+                _y_ = strlen(_b_);                      \
+                _c_ = alloca(_x_ + _y_ + 1);            \
+                strcpy(stpcpy(_c_, _a_), _b_);          \
+                _c_;                                    \
+        })