[PATCH] fix compilation with gnu89 - Mailing list pgsql-hackers

From Rosen Penev
Subject [PATCH] fix compilation with gnu89
Date
Msg-id 1606710821-16577-1-git-send-email-rosenp@gmail.com
Whole thread Raw
Responses Re: [PATCH] fix compilation with gnu89  (Andres Freund <andres@anarazel.de>)
Re: [PATCH] fix compilation with gnu89  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
GCC 4.8.5 does not default to gnu99 or gnu11 like the newer versions.
---
 src/common/logging.c      | 3 ++-
 src/common/unicode_norm.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/common/logging.c b/src/common/logging.c
index f3fc0b8..2ac502a 100644
--- a/src/common/logging.c
+++ b/src/common/logging.c
@@ -112,7 +112,8 @@ pg_logging_init(const char *argv0)
 
             if (colors)
             {
-                for (char *token = strtok(colors, ":"); token; token = strtok(NULL, ":"))
+                char *token;
+                for (token = strtok(colors, ":"); token; token = strtok(NULL, ":"))
                 {
                     char       *e = strchr(token, '=');
 
diff --git a/src/common/unicode_norm.c b/src/common/unicode_norm.c
index ab5ce59..0de2e87 100644
--- a/src/common/unicode_norm.c
+++ b/src/common/unicode_norm.c
@@ -519,6 +519,7 @@ unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *
 {
     uint8        lastCanonicalClass = 0;
     UnicodeNormalizationQC result = UNICODE_NORM_QC_YES;
+    const pg_wchar *p;
 
     /*
      * For the "D" forms, we don't run the quickcheck.  We don't include the
@@ -530,7 +531,7 @@ unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *
     if (form == UNICODE_NFD || form == UNICODE_NFKD)
         return UNICODE_NORM_QC_MAYBE;
 
-    for (const pg_wchar *p = input; *p; p++)
+    for (p = input; *p; p++)
     {
         pg_wchar    ch = *p;
         uint8        canonicalClass;
-- 
1.8.3.1




pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Notes on physical replica failover with logical publisher or subscriber
Next
From: Tom Lane
Date:
Subject: Re: Improving spin-lock implementation on ARM.