aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-08-27 14:01:46 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-08-27 14:01:46 +0900
commit8301aa0bf145099e55443b8c10d00a62d20e0d29 (patch)
treedee970b9c80b599a83143e255d634e1293c89254 /src/resolve/resolved-dns-stream.c
parentmacro: introduce DEFINE_TRIVIAL_REF_UNREF_FUNC() macro and friends (diff)
downloadsystemd-8301aa0bf145099e55443b8c10d00a62d20e0d29.tar.gz
systemd-8301aa0bf145099e55443b8c10d00a62d20e0d29.tar.bz2
systemd-8301aa0bf145099e55443b8c10d00a62d20e0d29.zip
tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicable
Diffstat (limited to 'src/resolve/resolved-dns-stream.c')
-rw-r--r--src/resolve/resolved-dns-stream.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c
index c3ffc7593..9a5c7c34f 100644
--- a/src/resolve/resolved-dns-stream.c
+++ b/src/resolve/resolved-dns-stream.c
@@ -424,18 +424,11 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use
return 0;
}
-DnsStream *dns_stream_unref(DnsStream *s) {
+static DnsStream *dns_stream_free(DnsStream *s) {
DnsPacket *p;
Iterator i;
- if (!s)
- return NULL;
-
- assert(s->n_ref > 0);
- s->n_ref--;
-
- if (s->n_ref > 0)
- return NULL;
+ assert(s);
dns_stream_stop(s);
@@ -464,15 +457,7 @@ DnsStream *dns_stream_unref(DnsStream *s) {
return mfree(s);
}
-DnsStream *dns_stream_ref(DnsStream *s) {
- if (!s)
- return NULL;
-
- assert(s->n_ref > 0);
- s->n_ref++;
-
- return s;
-}
+DEFINE_TRIVIAL_REF_UNREF_FUNC(DnsStream, dns_stream, dns_stream_free);
int dns_stream_new(Manager *m, DnsStream **ret, DnsProtocol protocol, int fd, const union sockaddr_union *tfo_address) {
_cleanup_(dns_stream_unrefp) DnsStream *s = NULL;