]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hashmap: use ternary op to shorten code
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Dec 2018 08:50:01 +0000 (09:50 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Dec 2018 11:04:00 +0000 (12:04 +0100)
src/basic/hash-funcs.c
src/basic/hashmap.c

index d6dc34e60c976f3da05a83879eeb7210c23df0e9..1be43d41a93ff7ae1a78e0df57ea52f9247285b7 100644 (file)
@@ -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) {
index 0dd9f8ddd426aa6da69b8ed12c0da2bc038a866d..5a4bb37b8229b09d7d500f23c3a7a02ea9df0907 100644 (file)
@@ -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;