From 70b400d9c2322d9a6982514c951f1b2da85fe462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 18 Dec 2018 09:50:01 +0100 Subject: [PATCH] hashmap: use ternary op to shorten code --- src/basic/hash-funcs.c | 2 +- src/basic/hashmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/hash-funcs.c b/src/basic/hash-funcs.c index d6dc34e60c..1be43d41a9 100644 --- a/src/basic/hash-funcs.c +++ b/src/basic/hash-funcs.c @@ -65,7 +65,7 @@ int trivial_compare_func(const void *a, const void *b) { const struct hash_ops trivial_hash_ops = { .hash = trivial_hash_func, - .compare = trivial_compare_func + .compare = trivial_compare_func, }; void uint64_hash_func(const uint64_t *p, struct siphash *state) { diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 0dd9f8ddd4..5a4bb37b82 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -779,7 +779,7 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu h->type = type; h->from_pool = up; - h->hash_ops = hash_ops ? hash_ops : &trivial_hash_ops; + h->hash_ops = hash_ops ?: &trivial_hash_ops; if (type == HASHMAP_TYPE_ORDERED) { OrderedHashmap *lh = (OrderedHashmap*)h;