]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/hashmap.c
tree-wide: "<n>bit" → "<n>-bit"
[thirdparty/systemd.git] / src / basic / hashmap.c
index 3d6d99e6dede8af6922738856a5af3b5b574ba60..3093156748035ff22815b78d20c0596d1e7bbba5 100644 (file)
@@ -5,6 +5,9 @@
 #include <pthread.h>
 #include <stdint.h>
 #include <stdlib.h>
+#if HAVE_VALGRIND_VALGRIND_H
+#  include <valgrind/valgrind.h>
+#endif
 
 #include "alloc-util.h"
 #include "fileio.h"
@@ -171,9 +174,9 @@ struct _packed_ indirect_storage {
 };
 
 struct direct_storage {
-        /* This gives us 39 bytes on 64bit, or 35 bytes on 32bit.
-         * That's room for 4 set_entries + 4 DIB bytes + 3 unused bytes on 64bit,
-         *              or 7 set_entries + 7 DIB bytes + 0 unused bytes on 32bit. */
+        /* This gives us 39 bytes on 64-bit, or 35 bytes on 32-bit.
+         * That's room for 4 set_entries + 4 DIB bytes + 3 unused bytes on 64-bit,
+         *              or 7 set_entries + 7 DIB bytes + 0 unused bytes on 32-bit. */
         uint8_t storage[sizeof(struct indirect_storage)];
 };
 
@@ -295,10 +298,11 @@ void hashmap_trim_pools(void) {
         mempool_trim(&ordered_hashmap_pool);
 }
 
-#if VALGRIND
+#if HAVE_VALGRIND_VALGRIND_H
 _destructor_ static void cleanup_pools(void) {
         /* Be nice to valgrind */
-        hashmap_trim_pools();
+        if (RUNNING_ON_VALGRIND)
+                hashmap_trim_pools();
 }
 #endif