diff options
Diffstat (limited to 'src/resolve/resolved-dns-answer.c')
-rw-r--r-- | src/resolve/resolved-dns-answer.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c index 66dc5d0299..6767dca302 100644 --- a/src/resolve/resolved-dns-answer.c +++ b/src/resolve/resolved-dns-answer.c @@ -19,15 +19,6 @@ DnsAnswer *dns_answer_new(size_t n) { return a; } -DnsAnswer *dns_answer_ref(DnsAnswer *a) { - if (!a) - return NULL; - - assert(a->n_ref > 0); - a->n_ref++; - return a; -} - static void dns_answer_flush(DnsAnswer *a) { DnsResourceRecord *rr; @@ -40,21 +31,15 @@ static void dns_answer_flush(DnsAnswer *a) { a->n_rrs = 0; } -DnsAnswer *dns_answer_unref(DnsAnswer *a) { - if (!a) - return NULL; - - assert(a->n_ref > 0); - - if (a->n_ref == 1) { - dns_answer_flush(a); - free(a); - } else - a->n_ref--; +static DnsAnswer *dns_answer_free(DnsAnswer *a) { + assert(a); - return NULL; + dns_answer_flush(a); + return mfree(a); } +DEFINE_TRIVIAL_REF_UNREF_FUNC(DnsAnswer, dns_answer, dns_answer_free); + static int dns_answer_add_raw(DnsAnswer *a, DnsResourceRecord *rr, int ifindex, DnsAnswerFlags flags) { assert(rr); |