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-network/sd-ipv4acd.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-network/sd-ipv4acd.c')
-rw-r--r-- | src/libsystemd-network/sd-ipv4acd.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c index a40d40db90..6c12b5144e 100644 --- a/src/libsystemd-network/sd-ipv4acd.c +++ b/src/libsystemd-network/sd-ipv4acd.c @@ -97,25 +97,8 @@ static void ipv4acd_reset(sd_ipv4acd *acd) { ipv4acd_set_state(acd, IPV4ACD_STATE_INIT, true); } -sd_ipv4acd *sd_ipv4acd_ref(sd_ipv4acd *acd) { - if (!acd) - return NULL; - - assert_se(acd->n_ref >= 1); - acd->n_ref++; - - return acd; -} - -sd_ipv4acd *sd_ipv4acd_unref(sd_ipv4acd *acd) { - if (!acd) - return NULL; - - assert_se(acd->n_ref >= 1); - acd->n_ref--; - - if (acd->n_ref > 0) - return NULL; +static sd_ipv4acd *ipv4acd_free(sd_ipv4acd *acd) { + assert(acd); ipv4acd_reset(acd); sd_ipv4acd_detach_event(acd); @@ -123,6 +106,8 @@ sd_ipv4acd *sd_ipv4acd_unref(sd_ipv4acd *acd) { return mfree(acd); } +DEFINE_TRIVIAL_REF_UNREF_FUNC(sd_ipv4acd, sd_ipv4acd, ipv4acd_free); + int sd_ipv4acd_new(sd_ipv4acd **ret) { _cleanup_(sd_ipv4acd_unrefp) sd_ipv4acd *acd = NULL; |