]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hashmap: don't allow hashmap_type_info table to be optimized away
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Sep 2019 14:19:47 +0000 (16:19 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 May 2020 09:40:37 +0000 (11:40 +0200)
This makes debugging hashmaps harder, because we can't query the size.  Make
sure that table is always present.

src/basic/hashmap.c

index efbe95bb9e33f90e087fdad9e45b95da5e87a315..bbb7546093769a7b4a2c4942e4d8c4ba8014fa09 100644 (file)
@@ -254,7 +254,7 @@ struct hashmap_type_info {
         unsigned n_direct_buckets;
 };
 
-static const struct hashmap_type_info hashmap_type_info[_HASHMAP_TYPE_MAX] = {
+static _used_ const struct hashmap_type_info hashmap_type_info[_HASHMAP_TYPE_MAX] = {
         [HASHMAP_TYPE_PLAIN] = {
                 .head_size        = sizeof(Hashmap),
                 .entry_size       = sizeof(struct plain_hashmap_entry),