kumquat-buildroot/package/dnsmasq/0004-src-pattern.c-fix-build-with-gcc-4.8.patch
Fabrice Fontaine 610f52f3be package/dnsmasq: fix build with gcc 4.8
Fix the following build failure with gcc 4.8 raised since bump to
version 2.86 in commit 5b29096f8f:

pattern.c: In function 'is_valid_dns_name':
pattern.c:134:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (const char *c = value;; c++)
   ^
pattern.c:134:3: note: use option -std=c99 or -std=gnu99 to compile your code
pattern.c: In function 'is_valid_dns_name_pattern':
pattern.c:249:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (const char *c = value;; c++)
   ^

Fixes:
 - http://autobuild.buildroot.org/results/eb0c34ff58eaf103f51c7171ecd97a3bdb887601

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2022-03-03 22:26:01 +01:00

58 lines
1.8 KiB
Diff

From 0c89dd2fa0fe50b00bca638dbbacfbd361526e0a Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sun, 2 Jan 2022 21:57:52 +0100
Subject: [PATCH] src/pattern.c: fix build with gcc 4.8
Fix the following build failure:
pattern.c: In function 'is_valid_dns_name':
pattern.c:134:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (const char *c = value;; c++)
^
pattern.c:134:3: note: use option -std=c99 or -std=gnu99 to compile your code
pattern.c: In function 'is_valid_dns_name_pattern':
pattern.c:249:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (const char *c = value;; c++)
^
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Retrieved from:
https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=b2690415bfa1bc105e61b75f642fb5c1aaf0fae8]
---
src/pattern.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pattern.c b/src/pattern.c
index 03e23b9..928d259 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -129,9 +129,9 @@ int is_valid_dns_name(const char *value)
size_t num_bytes = 0;
size_t num_labels = 0;
- const char *label = NULL;
+ const char *c, *label = NULL;
int is_label_numeric = 1;
- for (const char *c = value;; c++)
+ for (c = value;; c++)
{
if (*c &&
*c != '-' && *c != '.' &&
@@ -242,11 +242,11 @@ int is_valid_dns_name_pattern(const char *value)
size_t num_bytes = 0;
size_t num_labels = 0;
- const char *label = NULL;
+ const char *c, *label = NULL;
int is_label_numeric = 1;
size_t num_wildcards = 0;
int previous_label_has_wildcard = 1;
- for (const char *c = value;; c++)
+ for (c = value;; c++)
{
if (*c &&
*c != '*' && /* Wildcard. */
--
2.20.1