summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-dns-rr.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-08-27 07:01:46 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-08-27 07:01:46 +0200
commit8301aa0bf145099e55443b8c10d00a62d20e0d29 (patch)
treedee970b9c80b599a83143e255d634e1293c89254 /src/resolve/resolved-dns-rr.c
parentmacro: introduce DEFINE_TRIVIAL_REF_UNREF_FUNC() macro and friends (diff)
downloadsystemd-8301aa0bf145099e55443b8c10d00a62d20e0d29.tar.xz
systemd-8301aa0bf145099e55443b8c10d00a62d20e0d29.zip
tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicable
Diffstat (limited to 'src/resolve/resolved-dns-rr.c')
-rw-r--r--src/resolve/resolved-dns-rr.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c
index e6d997ed97..67565d267e 100644
--- a/src/resolve/resolved-dns-rr.c
+++ b/src/resolve/resolved-dns-rr.c
@@ -399,26 +399,8 @@ DnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, c
return dns_resource_record_new(key);
}
-DnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr) {
- if (!rr)
- return NULL;
-
- assert(rr->n_ref > 0);
- rr->n_ref++;
-
- return rr;
-}
-
-DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) {
- if (!rr)
- return NULL;
-
- assert(rr->n_ref > 0);
-
- if (rr->n_ref > 1) {
- rr->n_ref--;
- return NULL;
- }
+static DnsResourceRecord* dns_resource_record_free(DnsResourceRecord *rr) {
+ assert(rr);
if (rr->key) {
switch(rr->key->type) {
@@ -512,6 +494,8 @@ DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) {
return mfree(rr);
}
+DEFINE_TRIVIAL_REF_UNREF_FUNC(DnsResourceRecord, dns_resource_record, dns_resource_record_free);
+
int dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *hostname) {
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;