diff options
author | Sven Eden <yamakuzure@gmx.net> | 2017-12-08 08:02:34 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-12-08 17:54:19 +0100 |
commit | b2ba58acabda1830f0e58ba0d623861a126c43bf (patch) | |
tree | 0ffbb2698889e33259bb34444caaff1a04f5ce18 /src/basic | |
parent | 350ba9b9374ce045ead8c85c6c2e055729026c0e (diff) |
Apply missing updates from upstream
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/hashmap.c | 22 | ||||
-rw-r--r-- | src/basic/process-util.c | 12 | ||||
-rw-r--r-- | src/basic/socket-util.c | 2 | ||||
-rw-r--r-- | src/basic/string-util.c | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 237826e81..bcef42e11 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -34,7 +34,7 @@ #include "strv.h" #include "util.h" -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP #include <pthread.h> #include "list.h" #endif @@ -142,7 +142,7 @@ typedef uint8_t dib_raw_t; #define DIB_FREE UINT_MAX -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP struct hashmap_debug_info { LIST_FIELDS(struct hashmap_debug_info, debug_list); unsigned max_entries; /* high watermark of n_entries */ @@ -499,7 +499,7 @@ static void base_remove_entry(HashmapBase *h, unsigned idx) { dibs = dib_raw_ptr(h); assert(dibs[idx] != DIB_RAW_FREE); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.rem_count++; h->debug.last_rem_idx = idx; #endif @@ -578,7 +578,7 @@ static unsigned hashmap_iterate_in_insertion_order(OrderedHashmap *h, Iterator * assert(e->p.b.key == i->next_key); } -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP i->prev_idx = idx; #endif @@ -635,7 +635,7 @@ static unsigned hashmap_iterate_in_internal_order(HashmapBase *h, Iterator *i) { } idx = i->idx; -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP i->prev_idx = idx; #endif @@ -658,7 +658,7 @@ static unsigned hashmap_iterate_entry(HashmapBase *h, Iterator *i) { return IDX_NIL; } -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP if (i->idx == IDX_FIRST) { i->put_count = h->debug.put_count; i->rem_count = h->debug.rem_count; @@ -750,7 +750,7 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu shared_hash_key_initialized= true; } -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.func = func; h->debug.file = file; h->debug.line = line; @@ -807,7 +807,7 @@ static void hashmap_free_no_clear(HashmapBase *h) { assert(!h->has_indirect); assert(!h->n_direct_entries); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0); LIST_REMOVE(debug_list, hashmap_debug_list, &h->debug); assert_se(pthread_mutex_unlock(&hashmap_debug_list_mutex) == 0); @@ -919,7 +919,7 @@ static bool hashmap_put_robin_hood(HashmapBase *h, unsigned idx, dib_raw_t raw_dib, *dibs; unsigned dib, distance; -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.put_count++; #endif @@ -1012,7 +1012,7 @@ static int hashmap_base_put_boldly(HashmapBase *h, unsigned idx, assert_se(hashmap_put_robin_hood(h, idx, swap) == false); n_entries_inc(h); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.max_entries = MAX(h->debug.max_entries, n_entries(h)); #endif @@ -1240,7 +1240,7 @@ int hashmap_replace(Hashmap *h, const void *key, void *value) { idx = bucket_scan(h, hash, key); if (idx != IDX_NIL) { e = plain_bucket_at(h, idx); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP /* Although the key is equal, the key pointer may have changed, * and this would break our assumption for iterating. So count * this operation as incompatible with iteration. */ diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 29eaa1e8e..d15027751 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -34,7 +34,7 @@ #include <sys/wait.h> #include <syslog.h> #include <unistd.h> -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H #include <valgrind/valgrind.h> #endif @@ -480,7 +480,7 @@ static int get_process_id(pid_t pid, const char *field, uid_t *uid) { assert(field); assert(uid); - if (!pid_is_valid(pid)) + if (pid < 0) return -EINVAL; p = procfs_file_alloca(pid, "status"); @@ -795,7 +795,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value) { bool pid_is_unwaited(pid_t pid) { /* Checks whether a PID is still valid at all, including a zombie */ - if (!pid_is_valid(pid)) + if (pid < 0) return false; if (pid <= 1) /* If we or PID 1 would be dead and have been waited for, this code would not be running */ @@ -815,7 +815,7 @@ bool pid_is_alive(pid_t pid) { /* Checks whether a PID is still valid and not a zombie */ - if (!pid_is_valid(pid)) + if (pid < 0) return false; if (pid <= 1) /* If we or PID 1 would be a zombie, this code would not be running */ @@ -835,7 +835,7 @@ bool pid_is_alive(pid_t pid) { int pid_from_same_root_fs(pid_t pid) { const char *root; - if (!pid_is_valid(pid)) + if (pid < 0) return false; if (pid == 0 || pid == getpid_cached()) @@ -956,7 +956,7 @@ int opinionated_personality(unsigned long *ret) { } void valgrind_summary_hack(void) { -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H if (getpid_cached() == 1 && RUNNING_ON_VALGRIND) { pid_t pid; pid = raw_clone(SIGCHLD); diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index f71fb98f2..a94d89a63 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -49,7 +49,7 @@ #include "util.h" #if 0 /// UNNEEDED by elogind -#ifdef ENABLE_IDN +#if ENABLE_IDN # define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES) #else # define IDN_FLAGS 0 diff --git a/src/basic/string-util.c b/src/basic/string-util.c index c3d7d208f..6ef52ca88 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -830,7 +830,7 @@ int free_and_strdup(char **p, const char *s) { return 1; } -#if !HAVE_DECL_EXPLICIT_BZERO +#if !HAVE_EXPLICIT_BZERO /* * Pointer to memset is volatile so that compiler must de-reference * the pointer and can't assume that it points to any function in |