SHA256
1
0
forked from pool/gpg2
gpg2/0002-libdns-Avoid-using-compound-literals-2.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

96 lines
3.6 KiB
Diff

From 455ef62d29a112de05897139716265d07e4c6ae3 Mon Sep 17 00:00:00 2001
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Tue, 26 Feb 2019 10:04:09 +0900
Subject: [PATCH 2/8] libdns: Avoid using compound literals (2).
* dirmngr/dns.h (dns_strsection1, dns_strsection3): Remove.
(dns_strclass1, dns_strclass3): Remove.
(dns_strtype1, dns_strtype3): Remove.
(dns_strsection, dns_strclass, dns_strtype): Directly use the
function.
* dirmngr/dns.c (dns_strsection): Use automatic variable.
(dns_strclass, dns_strtype): Likewise.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
---
dirmngr/dns.c | 15 +++++++++------
dirmngr/dns.h | 16 +++-------------
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
index 0645d2f55..92084d112 100644
--- a/dirmngr/dns.c
+++ b/dirmngr/dns.c
@@ -10086,8 +10086,9 @@ static const struct {
{ "AR", DNS_S_ADDITIONAL },
};
-const char *(dns_strsection)(enum dns_section section, void *_dst, size_t lim) {
- struct dns_buf dst = DNS_B_INTO(_dst, lim);
+const char *(dns_strsection)(enum dns_section section) {
+ char _dst[DNS_STRMAXLEN + 1] = { 0 };
+ struct dns_buf dst = DNS_B_INTO(_dst, sizeof _dst);
unsigned i;
for (i = 0; i < lengthof(dns_sections); i++) {
@@ -10135,8 +10136,9 @@ static const struct {
{ "IN", DNS_C_IN },
};
-const char *(dns_strclass)(enum dns_class type, void *_dst, size_t lim) {
- struct dns_buf dst = DNS_B_INTO(_dst, lim);
+const char *(dns_strclass)(enum dns_class type) {
+ char _dst[DNS_STRMAXLEN + 1] = { 0 };
+ struct dns_buf dst = DNS_B_INTO(_dst, sizeof _dst);
unsigned i;
for (i = 0; i < lengthof(dns_classes); i++) {
@@ -10171,8 +10173,9 @@ enum dns_class dns_iclass(const char *name) {
} /* dns_iclass() */
-const char *(dns_strtype)(enum dns_type type, void *_dst, size_t lim) {
- struct dns_buf dst = DNS_B_INTO(_dst, lim);
+const char *(dns_strtype)(enum dns_type type) {
+ char _dst[DNS_STRMAXLEN + 1] = { 0 };
+ struct dns_buf dst = DNS_B_INTO(_dst, sizeof _dst);
unsigned i;
for (i = 0; i < lengthof(dns_rrtypes); i++) {
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
index 30d0b45af..6dedfbc91 100644
--- a/dirmngr/dns.h
+++ b/dirmngr/dns.h
@@ -291,25 +291,15 @@ enum dns_rcode {
*/
#define DNS_STRMAXLEN 47 /* "QUESTION|ANSWER|AUTHORITY|ADDITIONAL" */
-DNS_PUBLIC const char *dns_strsection(enum dns_section, void *, size_t);
-#define dns_strsection3(a, b, c) \
- dns_strsection((a), (b), (c))
-#define dns_strsection1(a) dns_strsection((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
-#define dns_strsection(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strsection, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
+DNS_PUBLIC const char *dns_strsection(enum dns_section);
DNS_PUBLIC enum dns_section dns_isection(const char *);
-DNS_PUBLIC const char *dns_strclass(enum dns_class, void *, size_t);
-#define dns_strclass3(a, b, c) dns_strclass((a), (b), (c))
-#define dns_strclass1(a) dns_strclass((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
-#define dns_strclass(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strclass, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
+DNS_PUBLIC const char *dns_strclass(enum dns_class);
DNS_PUBLIC enum dns_class dns_iclass(const char *);
-DNS_PUBLIC const char *dns_strtype(enum dns_type, void *, size_t);
-#define dns_strtype3(a, b, c) dns_strtype((a), (b), (c))
-#define dns_strtype1(a) dns_strtype((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
-#define dns_strtype(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strtype, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
+DNS_PUBLIC const char *dns_strtype(enum dns_type);
DNS_PUBLIC enum dns_type dns_itype(const char *);
--
2.20.1