diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-11-27 22:25:20 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-12-02 07:53:27 +0100 |
commit | 7a08d314f20b5d6ca44c573426a8a5c812020344 (patch) | |
tree | 871818dbd5a37c437f5dad5e6a15bcccad9c4b45 /src/libsystemd/sd-bus/bus-objects.c | |
parent | 25073e5012cdb4de13d815197815c33194ff7dc9 (diff) | |
download | systemd-7a08d314f20b5d6ca44c573426a8a5c812020344.tar.gz |
tree-wide: make hash_ops typesafe
Diffstat (limited to 'src/libsystemd/sd-bus/bus-objects.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-objects.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c index 03c8e56ef8..7e90a56e67 100644 --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c @@ -1582,9 +1582,7 @@ _public_ int sd_bus_add_fallback( return bus_add_object(bus, slot, true, prefix, callback, userdata); } -static void vtable_member_hash_func(const void *a, struct siphash *state) { - const struct vtable_member *m = a; - +static void vtable_member_hash_func(const struct vtable_member *m, struct siphash *state) { assert(m); string_hash_func(m->path, state); @@ -1592,8 +1590,7 @@ static void vtable_member_hash_func(const void *a, struct siphash *state) { string_hash_func(m->member, state); } -static int vtable_member_compare_func(const void *a, const void *b) { - const struct vtable_member *x = a, *y = b; +static int vtable_member_compare_func(const struct vtable_member *x, const struct vtable_member *y) { int r; assert(x); @@ -1610,10 +1607,7 @@ static int vtable_member_compare_func(const void *a, const void *b) { return strcmp(x->member, y->member); } -static const struct hash_ops vtable_member_hash_ops = { - .hash = vtable_member_hash_func, - .compare = vtable_member_compare_func -}; +DEFINE_PRIVATE_HASH_OPS(vtable_member_hash_ops, struct vtable_member, vtable_member_hash_func, vtable_member_compare_func); static int add_object_vtable_internal( sd_bus *bus, |