summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-08-13 01:00:18 +0200
committerMichal Schmidt <mschmidt@redhat.com>2014-09-15 16:08:50 +0200
commitd5099efc47d4e6ac60816b5381a5f607ab03f06e (patch)
tree661308aae8a0885e90da25874e7df3e795532356 /src/journal/sd-journal.c
parentf44541bc934c6e2b02155559e9eeb17a13a09558 (diff)
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.
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r--src/journal/sd-journal.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 693707cb34..1fc9f01d0a 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -70,7 +70,7 @@ static int set_put_error(sd_journal *j, int r) {
if (r >= 0)
return r;
- k = set_ensure_allocated(&j->errors, trivial_hash_func, trivial_compare_func);
+ k = set_ensure_allocated(&j->errors, NULL);
if (k < 0)
return k;
@@ -1662,7 +1662,7 @@ static int allocate_inotify(sd_journal *j) {
}
if (!j->directories_by_wd) {
- j->directories_by_wd = hashmap_new(trivial_hash_func, trivial_compare_func);
+ j->directories_by_wd = hashmap_new(NULL);
if (!j->directories_by_wd)
return -ENOMEM;
}
@@ -1688,8 +1688,8 @@ static sd_journal *journal_new(int flags, const char *path) {
goto fail;
}
- j->files = hashmap_new(string_hash_func, string_compare_func);
- j->directories_by_path = hashmap_new(string_hash_func, string_compare_func);
+ j->files = hashmap_new(&string_hash_ops);
+ j->directories_by_path = hashmap_new(&string_hash_ops);
j->mmap = mmap_cache_new();
if (!j->files || !j->directories_by_path || !j->mmap)
goto fail;