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/core/automount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/automount.c') diff --git a/src/core/automount.c b/src/core/automount.c index 73a8ce17e4..f72aca2957 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -685,7 +685,7 @@ static int automount_deserialize_item(Unit *u, const char *key, const char *valu log_debug_unit(u->id, "Failed to parse token value %s", value); else { if (!a->tokens) - if (!(a->tokens = set_new(trivial_hash_func, trivial_compare_func))) + if (!(a->tokens = set_new(NULL))) return -ENOMEM; r = set_put(a->tokens, UINT_TO_PTR(token)); @@ -762,7 +762,7 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo } else log_debug_unit(UNIT(a)->id, "Got direct mount request on %s", a->where); - r = set_ensure_allocated(&a->tokens, trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&a->tokens, NULL); if (r < 0) { log_error_unit(UNIT(a)->id, "Failed to allocate token set."); goto fail; -- cgit v1.2.3-54-g00ecf