chiark / gitweb /
journalctl: correct help text for --until
[elogind.git] / src / shared / util.h
index 08d556fc924a47aabe4c86d0554c49f3f39a40b0..887cdc4a445413bbfccba6168f1f883ef91c89f3 100644 (file)
@@ -205,7 +205,7 @@ int safe_atod(const char *s, double *ret_d);
 
 int safe_atou8(const char *s, uint8_t *ret);
 
-#if __WORDSIZE == 32
+#if LONG_MAX == INT_MAX
 static inline int safe_atolu(const char *s, unsigned long *ret_u) {
         assert_cc(sizeof(unsigned long) == sizeof(unsigned));
         return safe_atou(s, (unsigned*) ret_u);
@@ -852,6 +852,22 @@ int unlink_noerrno(const char *path);
                 (void *) memset(_new_, 0, _len_);       \
         })
 
+#define alloca_align(size, align)                                       \
+        ({                                                              \
+                void *_ptr_;                                            \
+                size_t _mask_ = (align) - 1;                            \
+                _ptr_ = alloca((size) + _mask_);                        \
+                (void*)(((uintptr_t)_ptr_ + _mask_) & ~_mask_);         \
+        })
+
+#define alloca0_align(size, align)                                      \
+        ({                                                              \
+                void *_new_;                                            \
+                size_t _size_ = (size);                                 \
+                _new_ = alloca_align(_size_, (align));                  \
+                (void*)memset(_new_, 0, _size_);                        \
+        })
+
 #define strappenda(a, ...)                                       \
         ({                                                       \
                 int _len = strlen(a);                            \
@@ -975,6 +991,7 @@ bool is_localhost(const char *hostname);
 int take_password_lock(const char *root);
 
 int is_symlink(const char *path);
+int is_dir(const char *path, bool follow);
 
 int unquote_first_word(const char **p, char **ret);
 int unquote_many_words(const char **p, ...) _sentinel_;