summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-18 09:50:01 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-18 12:04:00 +0100
commit70b400d9c2322d9a6982514c951f1b2da85fe462 (patch)
tree616b969bd05f46702f448e2e3cc44539685a554f
parent7f09920585f65c62e042af77b47b2a217e46d779 (diff)
downloadsystemd-70b400d9c2322d9a6982514c951f1b2da85fe462.tar.gz
hashmap: use ternary op to shorten code
-rw-r--r--src/basic/hash-funcs.c2
-rw-r--r--src/basic/hashmap.c2
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;