chiark / gitweb /
tree-wide: beautify remaining copyright statements
[elogind.git] / src / basic / hashmap.c
index 876a10eeb3f23e67099f1e7d52a15c64de612185..5dff27425585cd8edb1882196e32df4ddb3d47d8 100644 (file)
@@ -1,22 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 /***
-  This file is part of systemd.
-
-  Copyright 2010 Lennart Poettering
-  Copyright 2014 Michal Schmidt
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+  Copyright © 2014 Michal Schmidt
 ***/
 
 #include <errno.h>
@@ -294,7 +278,7 @@ static const struct hashmap_type_info hashmap_type_info[_HASHMAP_TYPE_MAX] = {
         },
 };
 
-#ifdef VALGRIND
+#if VALGRIND
 __attribute__((destructor)) static void cleanup_pools(void) {
         _cleanup_free_ char *t = NULL;
         int r;
@@ -1904,8 +1888,6 @@ int set_put_strsplit(Set *s, const char *v, const char *separators, ExtractFlags
 
 /* expand the cachemem if needed, return true if newly (re)activated. */
 static int cachemem_maintain(CacheMem *mem, unsigned size) {
-        int r = false;
-
         assert(mem);
 
         if (!GREEDY_REALLOC(mem->ptr, mem->n_allocated, size)) {
@@ -1913,10 +1895,12 @@ static int cachemem_maintain(CacheMem *mem, unsigned size) {
                         return -ENOMEM;
         }
 
-        if (!mem->active)
-                mem->active = r = true;
+        if (!mem->active) {
+                mem->active = true;
+                return true;
+        }
 
-        return r;
+        return false;
 }
 
 int iterated_cache_get(IteratedCache *cache, const void ***res_keys, const void ***res_values, unsigned *res_n_entries) {