2de02a0a4a
OBS-URL: https://build.opensuse.org/request/show/679738 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gpg2?expand=0&rev=136
69 lines
2.4 KiB
Diff
69 lines
2.4 KiB
Diff
From 7313a112f9c7ada61d24285313d2e2d069a672e8 Mon Sep 17 00:00:00 2001
|
|
From: NIIBE Yutaka <gniibe@fsij.org>
|
|
Date: Tue, 26 Feb 2019 10:58:16 +0900
|
|
Subject: [PATCH 4/8] libdns: Avoid using compound literals (4).
|
|
|
|
* dirmngr/dns.h (dns_d_new*): Remove.
|
|
* dirmngr/dns.c (parse_packet): Use dns_d_init with automatic
|
|
variable.
|
|
(parse_domain): Likewise.
|
|
|
|
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
---
|
|
dirmngr/dns.c | 8 ++++++--
|
|
dirmngr/dns.h | 5 -----
|
|
2 files changed, 6 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
|
index 6acb4faa2..f6a158789 100644
|
|
--- a/dirmngr/dns.c
|
|
+++ b/dirmngr/dns.c
|
|
@@ -10632,8 +10632,11 @@ static int parse_packet(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
|
#if 0
|
|
dns_rr_foreach(&rr, Q, .name = "ns8.yahoo.com.") {
|
|
#else
|
|
+ char _p[DNS_D_MAXNAME + 1] = { 0 };
|
|
+ const char *dn = "ns8.yahoo.com";
|
|
+ char *_name = dns_d_init(_p, sizeof _p, dn, strlen (dn), DNS_D_ANCHOR);
|
|
struct dns_rr rrset[32];
|
|
- struct dns_rr_i *rri = dns_rr_i_new(Q, .name = dns_d_new("ns8.yahoo.com", DNS_D_ANCHOR), .sort = MAIN.sort);
|
|
+ struct dns_rr_i *rri = dns_rr_i_new(Q, .name = _name, .sort = MAIN.sort);
|
|
unsigned rrcount = dns_rr_grep(rrset, lengthof(rrset), rri, Q, &error);
|
|
|
|
for (unsigned i = 0; i < rrcount; i++) {
|
|
@@ -10661,13 +10664,14 @@ static int parse_packet(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
|
|
|
|
|
static int parse_domain(int argc, char *argv[]) {
|
|
+ char _p[DNS_D_MAXNAME + 1] = { 0 };
|
|
char *dn;
|
|
|
|
dn = (argc > 1)? argv[1] : "f.l.google.com";
|
|
|
|
printf("[%s]\n", dn);
|
|
|
|
- dn = dns_d_new(dn);
|
|
+ dn = dns_d_init(_p, sizeof _p, dn, strlen (dn), DNS_D_ANCHOR);
|
|
|
|
do {
|
|
puts(dn);
|
|
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
|
index 4a9417120..0953228f8 100644
|
|
--- a/dirmngr/dns.h
|
|
+++ b/dirmngr/dns.h
|
|
@@ -451,11 +451,6 @@ DNS_PUBLIC int dns_p_study(struct dns_packet *);
|
|
#define DNS_D_CLEAVE 2 /* cleave sub-domain */
|
|
#define DNS_D_TRIM 4 /* remove superfluous dots */
|
|
|
|
-#define dns_d_new3(a, b, f) dns_d_init(&(char[DNS_D_MAXNAME + 1]){ 0 }, DNS_D_MAXNAME + 1, (a), (b), (f))
|
|
-#define dns_d_new2(a, f) dns_d_new3((a), strlen((a)), (f))
|
|
-#define dns_d_new1(a) dns_d_new3((a), strlen((a)), DNS_D_ANCHOR)
|
|
-#define dns_d_new(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_d_new, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
|
|
-
|
|
DNS_PUBLIC char *dns_d_init(void *, size_t, const void *, size_t, int);
|
|
|
|
DNS_PUBLIC size_t dns_d_anchor(void *, size_t, const void *, size_t);
|
|
--
|
|
2.20.1
|
|
|