From: Zbigniew Jędrzejewski-Szmek Date: Tue, 18 Dec 2018 08:50:01 +0000 (+0100) Subject: hashmap: use ternary op to shorten code X-Git-Tag: v240~27^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70b400d9c2322d9a6982514c951f1b2da85fe462;p=thirdparty%2Fsystemd.git hashmap: use ternary op to shorten code --- diff --git a/src/basic/hash-funcs.c b/src/basic/hash-funcs.c index d6dc34e60c9..1be43d41a93 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 0dd9f8ddd42..5a4bb37b822 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;