From 91b3aaa46ccac30357fb3c89f1ff4caf9be8c4fd Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sun, 30 Aug 2020 08:29:38 +0900 Subject: [PATCH] Add changes to src/config/pool_config.l and regenerate src/config/pool_config.c. That is missed in previous commit a840ecb2c0aa15448f7fc63a7b0bb46949a9c24f. --- src/config/pool_config.c | 62 ++++++++++++++++++++-------------------- src/config/pool_config.l | 10 ++++++- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/config/pool_config.c b/src/config/pool_config.c index c1165010c..a7340e73f 100644 --- a/src/config/pool_config.c +++ b/src/config/pool_config.c @@ -8,7 +8,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 37 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -46,7 +46,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -54,7 +53,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,6 +83,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -332,7 +332,7 @@ void yyfree (void * ); /* Begin user sect3 */ -#define yywrap(n) 1 +#define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -358,7 +358,7 @@ static void yy_fatal_error (yyconst char msg[] ); */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -480,8 +480,6 @@ static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; -char *config_file_dir = NULL; /* directory path of config file pgpool.conf */ - /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -537,6 +535,7 @@ int yylex(void); POOL_CONFIG g_pool_config; /* configuration values */ POOL_CONFIG *pool_config = &g_pool_config; /* for lagacy reason pointer to the above struct */ static unsigned Lineno; +char *config_file_dir = NULL; /* directory path of config file pgpool.conf */ typedef enum { POOL_KEY = 1, @@ -555,7 +554,7 @@ static bool ParseConfigFile( const char *config_file, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p); #define YY_NO_INPUT 1 -#line 556 "config/pool_config.c" +#line 558 "config/pool_config.c" #define INITIAL 0 @@ -642,7 +641,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -653,7 +652,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -735,10 +734,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 90 "pool_config.l" +#line 92 "pool_config.l" -#line 739 "config/pool_config.c" +#line 741 "config/pool_config.c" if ( !(yy_init) ) { @@ -820,12 +819,12 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 92 "pool_config.l" +#line 94 "pool_config.l" Lineno++; return POOL_EOL; YY_BREAK case 2: YY_RULE_SETUP -#line 93 "pool_config.l" +#line 95 "pool_config.l" /* eat whitespace */ YY_BREAK case 3: @@ -833,50 +832,50 @@ case 3: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 94 "pool_config.l" +#line 96 "pool_config.l" /* eat comment */ YY_BREAK case 4: YY_RULE_SETUP -#line 96 "pool_config.l" +#line 98 "pool_config.l" return POOL_KEY; YY_BREAK case 5: YY_RULE_SETUP -#line 97 "pool_config.l" +#line 99 "pool_config.l" return POOL_STRING; YY_BREAK case 6: YY_RULE_SETUP -#line 98 "pool_config.l" +#line 100 "pool_config.l" return POOL_UNQUOTED_STRING; YY_BREAK case 7: YY_RULE_SETUP -#line 99 "pool_config.l" +#line 101 "pool_config.l" return POOL_INTEGER; YY_BREAK case 8: YY_RULE_SETUP -#line 100 "pool_config.l" +#line 102 "pool_config.l" return POOL_REAL; YY_BREAK case 9: YY_RULE_SETUP -#line 101 "pool_config.l" +#line 103 "pool_config.l" return POOL_EQUALS; YY_BREAK case 10: YY_RULE_SETUP -#line 103 "pool_config.l" +#line 105 "pool_config.l" return POOL_PARSE_ERROR; YY_BREAK case 11: YY_RULE_SETUP -#line 105 "pool_config.l" +#line 107 "pool_config.l" ECHO; YY_BREAK -#line 877 "config/pool_config.c" +#line 879 "config/pool_config.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1070,7 +1069,7 @@ static int yy_get_next_buffer (void) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); @@ -1203,7 +1202,7 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 39); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT @@ -1254,7 +1253,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) - return 0; + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1594,8 +1593,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -1603,7 +1602,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -1833,7 +1833,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 105 "pool_config.l" +#line 107 "pool_config.l" diff --git a/src/config/pool_config.l b/src/config/pool_config.l index 0211db98f..026ae6e92 100644 --- a/src/config/pool_config.l +++ b/src/config/pool_config.l @@ -32,6 +32,7 @@ #include "pool_config.h" #include "pool_config_variables.h" #include "utils/regex_array.h" +#include "utils/pool_path.h" #ifndef POOL_PRIVATE #include "utils/elog.h" #else @@ -44,6 +45,7 @@ int yylex(void); POOL_CONFIG g_pool_config; /* configuration values */ POOL_CONFIG *pool_config = &g_pool_config; /* for lagacy reason pointer to the above struct */ static unsigned Lineno; +char *config_file_dir = NULL; /* directory path of config file pgpool.conf */ typedef enum { POOL_KEY = 1, @@ -332,9 +334,15 @@ ParseConfigFile(const char *config_file, int elevel, char *key; char *val; ConfigVariable *item; - + char buf[POOLMAXPATHLEN + 1]; + *head_p = NULL; + /* get directory path of config file pgpool.conf */ + strlcpy(buf, config_file, sizeof(buf)); + get_parent_directory(buf); + config_file_dir = buf; + /* open config file */ fd = fopen(config_file, "r"); if (!fd) -- 2.39.5