diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-08-27 07:01:46 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-08-27 07:01:46 +0200 |
commit | 8301aa0bf145099e55443b8c10d00a62d20e0d29 (patch) | |
tree | dee970b9c80b599a83143e255d634e1293c89254 /src/libsystemd/sd-bus/bus-track.c | |
parent | macro: introduce DEFINE_TRIVIAL_REF_UNREF_FUNC() macro and friends (diff) | |
download | systemd-8301aa0bf145099e55443b8c10d00a62d20e0d29.tar.xz systemd-8301aa0bf145099e55443b8c10d00a62d20e0d29.zip |
tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicable
Diffstat (limited to 'src/libsystemd/sd-bus/bus-track.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-track.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c index d183eb57dc..4c959cc29c 100644 --- a/src/libsystemd/sd-bus/bus-track.c +++ b/src/libsystemd/sd-bus/bus-track.c @@ -143,27 +143,8 @@ _public_ int sd_bus_track_new( return 0; } -_public_ sd_bus_track* sd_bus_track_ref(sd_bus_track *track) { - - if (!track) - return NULL; - - assert(track->n_ref > 0); - - track->n_ref++; - - return track; -} - -_public_ sd_bus_track* sd_bus_track_unref(sd_bus_track *track) { - if (!track) - return NULL; - - assert(track->n_ref > 0); - track->n_ref--; - - if (track->n_ref > 0) - return NULL; +static sd_bus_track *track_free(sd_bus_track *track) { + assert(track); if (track->in_list) LIST_REMOVE(tracks, track->bus->tracks, track); @@ -178,6 +159,8 @@ _public_ sd_bus_track* sd_bus_track_unref(sd_bus_track *track) { return mfree(track); } +DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(sd_bus_track, sd_bus_track, track_free); + static int on_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error) { sd_bus_track *track = userdata; const char *name, *old, *new; |