0004-src-pattern.c-fix-build-with-gcc-4.8.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From 0c89dd2fa0fe50b00bca638dbbacfbd361526e0a Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 2 Jan 2022 21:57:52 +0100
  4. Subject: [PATCH] src/pattern.c: fix build with gcc 4.8
  5. Fix the following build failure:
  6. pattern.c: In function 'is_valid_dns_name':
  7. pattern.c:134:3: error: 'for' loop initial declarations are only allowed in C99 mode
  8. for (const char *c = value;; c++)
  9. ^
  10. pattern.c:134:3: note: use option -std=c99 or -std=gnu99 to compile your code
  11. pattern.c: In function 'is_valid_dns_name_pattern':
  12. pattern.c:249:3: error: 'for' loop initial declarations are only allowed in C99 mode
  13. for (const char *c = value;; c++)
  14. ^
  15. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  16. [Retrieved from:
  17. https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=b2690415bfa1bc105e61b75f642fb5c1aaf0fae8]
  18. ---
  19. src/pattern.c | 8 ++++----
  20. 1 file changed, 4 insertions(+), 4 deletions(-)
  21. diff --git a/src/pattern.c b/src/pattern.c
  22. index 03e23b9..928d259 100644
  23. --- a/src/pattern.c
  24. +++ b/src/pattern.c
  25. @@ -129,9 +129,9 @@ int is_valid_dns_name(const char *value)
  26. size_t num_bytes = 0;
  27. size_t num_labels = 0;
  28. - const char *label = NULL;
  29. + const char *c, *label = NULL;
  30. int is_label_numeric = 1;
  31. - for (const char *c = value;; c++)
  32. + for (c = value;; c++)
  33. {
  34. if (*c &&
  35. *c != '-' && *c != '.' &&
  36. @@ -242,11 +242,11 @@ int is_valid_dns_name_pattern(const char *value)
  37. size_t num_bytes = 0;
  38. size_t num_labels = 0;
  39. - const char *label = NULL;
  40. + const char *c, *label = NULL;
  41. int is_label_numeric = 1;
  42. size_t num_wildcards = 0;
  43. int previous_label_has_wildcard = 1;
  44. - for (const char *c = value;; c++)
  45. + for (c = value;; c++)
  46. {
  47. if (*c &&
  48. *c != '*' && /* Wildcard. */
  49. --
  50. 2.20.1