diff options
author | David Tardon <dtardon@redhat.com> | 2021-03-18 12:50:27 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2021-03-18 13:19:13 +0100 |
commit | 037e5b154738373c88f4712e43697118e095a609 (patch) | |
tree | da905ad82ddd0836f7e62f1c7fb31caf67e556b9 /src/resolve | |
parent | resolved-dns-rr: avoid unnecessary reassignment (diff) | |
download | systemd-037e5b154738373c88f4712e43697118e095a609.tar.xz systemd-037e5b154738373c88f4712e43697118e095a609.zip |
resolved-dns-rr: use already existing variable
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 96024f6ca2..ffb1605c4c 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -871,18 +871,15 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { return NULL; break; - case DNS_TYPE_A: { - _cleanup_free_ char *x = NULL; - - r = in_addr_to_string(AF_INET, (const union in_addr_union*) &rr->a.in_addr, &x); + case DNS_TYPE_A: + r = in_addr_to_string(AF_INET, (const union in_addr_union*) &rr->a.in_addr, &t); if (r < 0) return NULL; - s = strjoin(k, " ", x); + s = strjoin(k, " ", t); if (!s) return NULL; break; - } case DNS_TYPE_AAAA: r = in_addr_to_string(AF_INET6, (const union in_addr_union*) &rr->aaaa.in6_addr, &t); @@ -1120,18 +1117,16 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { break; } - case DNS_TYPE_CAA: { - _cleanup_free_ char *value; - - value = octescape(rr->caa.value, rr->caa.value_size); - if (!value) + case DNS_TYPE_CAA: + t = octescape(rr->caa.value, rr->caa.value_size); + if (!t) return NULL; r = asprintf(&s, "%s %u %s \"%s\"%s%s%s%.0u", k, rr->caa.flags, rr->caa.tag, - value, + t, rr->caa.flags ? "\n -- Flags:" : "", rr->caa.flags & CAA_FLAG_CRITICAL ? " critical" : "", rr->caa.flags & ~CAA_FLAG_CRITICAL ? " " : "", @@ -1140,7 +1135,6 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { return NULL; break; - } case DNS_TYPE_OPENPGPKEY: { r = asprintf(&s, "%s", k); |