gpg2/0005-libdns-Avoid-using-compound-literals-5.patch
Tomáš Chvátal 6a078f40f8 Accepting request 679660 from home:pmonrealgonzalez:branches:Base:System
- Fix build with gcc9 [bsc#1121223]
  * Avoid using compound literals
    - Upstream bug: https://dev.gnupg.org/T4367
  * Added upstream patches:
    - 0001-libdns-Avoid-using-compound-literals.patch
    - 0002-libdns-Avoid-using-compound-literals-2.patch
    - 0003-libdns-Avoid-using-compound-literals-3.patch
    - 0004-libdns-Avoid-using-compound-literals-4.patch
    - 0005-libdns-Avoid-using-compound-literals-5.patch
    - 0006-libdns-Avoid-using-compound-literals-6.patch
    - 0007-libdns-Avoid-using-compound-literals-7.patch
    - 0008-libdns-Avoid-using-compound-literals-8.patch

OBS-URL: https://build.opensuse.org/request/show/679660
OBS-URL: https://build.opensuse.org/package/show/Base:System/gpg2?expand=0&rev=222
2019-02-27 08:22:45 +00:00

53 lines
1.8 KiB
Diff

From a1ccfe2b37847cce0db2fb94a7365c9fa501eda4 Mon Sep 17 00:00:00 2001
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Tue, 26 Feb 2019 11:43:10 +0900
Subject: [PATCH 5/8] libdns: Avoid using compound literals (5).
* dirmngr/dns.h (dns_rr_foreach): Don't use dns_rr_i_new.
Call dns_rr_grep with NULL.
* dirmngr/dns.c (dns_rr_grep): Support NULL for error_.
--
Here we still use C99 feature of struct member initialization in
dns_rr_foreach, for struct dns_rr_i. Note that in C99, it guarantees
non-specified member fields are initialized by zero. So, there's no
need to use dns_rr_i_new at all.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
---
dirmngr/dns.c | 3 ++-
dirmngr/dns.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
index f6a158789..85fd37fb2 100644
--- a/dirmngr/dns.c
+++ b/dirmngr/dns.c
@@ -3266,7 +3266,8 @@ unsigned dns_rr_grep(struct dns_rr *rr, unsigned lim, struct dns_rr_i *i, struct
return count;
error:
- *error_ = error;
+ if (error_)
+ *error_ = error;
return count;
} /* dns_rr_grep() */
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
index 0953228f8..da450c611 100644
--- a/dirmngr/dns.h
+++ b/dirmngr/dns.h
@@ -542,7 +542,7 @@ DNS_PUBLIC struct dns_rr_i *dns_rr_i_init(struct dns_rr_i *, struct dns_packet *
DNS_PUBLIC unsigned dns_rr_grep(struct dns_rr *, unsigned, struct dns_rr_i *, struct dns_packet *, int *);
#define dns_rr_foreach_(rr, P, ...) \
- for (struct dns_rr_i DNS_PP_XPASTE(i, __LINE__) = *dns_rr_i_new((P), __VA_ARGS__); dns_rr_grep((rr), 1, &DNS_PP_XPASTE(i, __LINE__), (P), &(int){ 0 }); )
+ for (struct dns_rr_i DNS_PP_XPASTE(i, __LINE__) = { __VA_ARGS__ }; dns_rr_grep((rr), 1, &DNS_PP_XPASTE(i, __LINE__), (P), NULL); )
#define dns_rr_foreach(...) dns_rr_foreach_(__VA_ARGS__)
--
2.20.1