chiark / gitweb /
Partially revert e62d8c394474
[elogind.git] / src / shared / util.h
index 52c33238b1ce5123274852984caf42fb39d72c7c..d1cdd901a04fc2a31603351f788eb09dec7585a0 100644 (file)
@@ -329,6 +329,7 @@ ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);
 bool is_device_path(const char *path);
 
 int dir_is_empty(const char *path);
+char* dirname_malloc(const char *path);
 
 void rename_process(const char name[8]);
 
@@ -594,7 +595,7 @@ int create_tmp_dir(char template[], char** dir_name);
 #define FOREACH_DIRENT(de, d, on_error)                                 \
         for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d))   \
                 if (!de) {                                              \
-                        if (errno != 0) {                               \
+                        if (errno > 0) {                                \
                                 on_error;                               \
                         }                                               \
                         break;                                          \
@@ -608,5 +609,9 @@ static inline void *mempset(void *s, int c, size_t n) {
 }
 
 char *hexmem(const void *p, size_t l);
+void *unhexmem(const char *p, size_t l);
+
 char *strextend(char **x, ...);
 char *strrep(const char *s, unsigned n);
+
+void* greedy_realloc(void **p, size_t *allocated, size_t need);