chiark / gitweb /
Add set_consume which always takes ownership
[elogind.git] / src / shared / util.c
index e8431839b044ecfb190772eaf4999e20f30c6930..a6ec79a29222042be9467d2cbc3410c71899a8a8 100644 (file)
@@ -80,15 +80,6 @@ char **saved_argv = NULL;
 static volatile unsigned cached_columns = 0;
 static volatile unsigned cached_lines = 0;
 
-#define procfs_file_alloca(pid, field)                                  \
-        ({                                                              \
-                pid_t _pid_ = (pid);                                    \
-                char *_r_;                                              \
-                _r_ = alloca(sizeof("/proc/") -1 + DECIMAL_STR_MAX(pid_t) + 1 + sizeof(field)); \
-                sprintf(_r_, "/proc/%lu/" field, (unsigned long) _pid_); \
-                _r_;                                                    \
-        })
-
 size_t page_size(void) {
         static __thread size_t pgsz = 0;
         long r;
@@ -2080,7 +2071,7 @@ int release_terminal(void) {
                 .sa_handler = SIG_IGN,
                 .sa_flags = SA_RESTART,
         };
-        int _cleanup_close_ fd;
+        _cleanup_close_ int fd;
 
         fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_NDELAY|O_CLOEXEC);
         if (fd < 0)
@@ -4344,7 +4335,7 @@ int in_group(const char *name) {
 }
 
 int glob_exists(const char *path) {
-        glob_t _cleanup_globfree_ g = {};
+        _cleanup_globfree_ glob_t g = {};
         int r, k;
 
         assert(path);