From 8301aa0bf145099e55443b8c10d00a62d20e0d29 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 27 Aug 2018 14:01:46 +0900 Subject: tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicable --- src/resolve/resolved-dns-search-domain.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/resolve/resolved-dns-search-domain.c') diff --git a/src/resolve/resolved-dns-search-domain.c b/src/resolve/resolved-dns-search-domain.c index c3817acf11..368ec4da19 100644 --- a/src/resolve/resolved-dns-search-domain.c +++ b/src/resolve/resolved-dns-search-domain.c @@ -65,30 +65,15 @@ int dns_search_domain_new( return 0; } -DnsSearchDomain* dns_search_domain_ref(DnsSearchDomain *d) { - if (!d) - return NULL; - - assert(d->n_ref > 0); - d->n_ref++; - - return d; -} - -DnsSearchDomain* dns_search_domain_unref(DnsSearchDomain *d) { - if (!d) - return NULL; - - assert(d->n_ref > 0); - d->n_ref--; - - if (d->n_ref > 0) - return NULL; +static DnsSearchDomain* dns_search_domain_free(DnsSearchDomain *d) { + assert(d); free(d->name); return mfree(d); } +DEFINE_TRIVIAL_REF_UNREF_FUNC(DnsSearchDomain, dns_search_domain, dns_search_domain_free); + void dns_search_domain_unlink(DnsSearchDomain *d) { assert(d); assert(d->manager); -- cgit v1.2.1