From d5099efc47d4e6ac60816b5381a5f607ab03f06e Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Wed, 13 Aug 2014 01:00:18 +0200 Subject: hashmap: introduce hash_ops to make struct Hashmap smaller It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory. --- src/cgtop/cgtop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cgtop') diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index 509fe4cdc8..ab8c4cfda1 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -695,8 +695,8 @@ int main(int argc, char *argv[]) { if (r <= 0) goto finish; - a = hashmap_new(string_hash_func, string_compare_func); - b = hashmap_new(string_hash_func, string_compare_func); + a = hashmap_new(&string_hash_ops); + b = hashmap_new(&string_hash_ops); if (!a || !b) { r = log_oom(); goto finish; -- cgit v1.2.3-54-g00ecf