Apply const qualifier to keywords of jsonpath_scan.l
authorAlexander Korotkov <[email protected]>
Sun, 17 Mar 2019 09:50:38 +0000 (12:50 +0300)
committerAlexander Korotkov <[email protected]>
Sun, 17 Mar 2019 09:50:38 +0000 (12:50 +0300)
Discussion: https://postgr.es/m/CAEeOP_a-Pfy%3DU9-f%3DgQ0AsB8FrxrC8xCTVq%2BeO71-2VoWP5cag%40mail.gmail.com
Author: Mark G

src/backend/utils/adt/jsonpath_scan.l

index 110ea2160d952c4faac301539d17a829607b2b29..06efe0e6ab969961b48a284cead1bf21c9f014a1 100644 (file)
@@ -284,10 +284,10 @@ jsonpath_yyerror(JsonPathParseResult **result, const char *message)
 
 typedef struct keyword
 {
-   int16   len;
-   bool    lowercase;
-   int     val;
-   char    *keyword;
+   int16       len;
+   bool        lowercase;
+   int         val;
+   const char  *keyword;
 } keyword;
 
 /*
@@ -295,7 +295,7 @@ typedef struct keyword
  * alphabetical order
  */
 
-static keyword keywords[] = {
+static const keyword keywords[] = {
    { 2, false, IS_P,       "is"},
    { 2, false, TO_P,       "to"},
    { 3, false, ABS_P,      "abs"},
@@ -322,11 +322,11 @@ static keyword keywords[] = {
 static int
 checkSpecialVal()
 {
-   int         res = IDENT_P;
-   int         diff;
-   keyword     *StopLow = keywords,
-               *StopHigh = keywords + lengthof(keywords),
-               *StopMiddle;
+   int             res = IDENT_P;
+   int             diff;
+   const keyword  *StopLow = keywords,
+                  *StopHigh = keywords + lengthof(keywords),
+                  *StopMiddle;
 
    if (scanstring.len > keywords[lengthof(keywords) - 1].len)
        return res;