diff options
Diffstat (limited to 'src/libstrongswan/settings')
-rw-r--r-- | src/libstrongswan/settings/settings.c | 14 | ||||
-rw-r--r-- | src/libstrongswan/settings/settings.h | 10 | ||||
-rw-r--r-- | src/libstrongswan/settings/settings_lexer.c | 233 | ||||
-rw-r--r-- | src/libstrongswan/settings/settings_parser.c | 44 | ||||
-rw-r--r-- | src/libstrongswan/settings/settings_parser.h | 8 |
5 files changed, 179 insertions, 130 deletions
diff --git a/src/libstrongswan/settings/settings.c b/src/libstrongswan/settings/settings.c index 56cc2f19b..829e78482 100644 --- a/src/libstrongswan/settings/settings.c +++ b/src/libstrongswan/settings/settings.c @@ -540,9 +540,9 @@ METHOD(settings_t, get_int, int, /** * Described in header */ -inline u_int64_t settings_value_as_uint64(char *value, u_int64_t def) +inline uint64_t settings_value_as_uint64(char *value, uint64_t def) { - u_int64_t intval; + uint64_t intval; char *end; int base = 10; @@ -597,10 +597,10 @@ METHOD(settings_t, get_double, double, /** * Described in header */ -inline u_int32_t settings_value_as_time(char *value, u_int32_t def) +inline uint32_t settings_value_as_time(char *value, uint32_t def) { char *endptr; - u_int32_t timeval; + uint32_t timeval; if (value) { errno = 0; @@ -638,8 +638,8 @@ inline u_int32_t settings_value_as_time(char *value, u_int32_t def) return def; } -METHOD(settings_t, get_time, u_int32_t, - private_settings_t *this, char *key, u_int32_t def, ...) +METHOD(settings_t, get_time, uint32_t, + private_settings_t *this, char *key, uint32_t def, ...) { char *value; va_list args; @@ -695,7 +695,7 @@ METHOD(settings_t, set_double, void, } METHOD(settings_t, set_time, void, - private_settings_t *this, char *key, u_int32_t value, ...) + private_settings_t *this, char *key, uint32_t value, ...) { char val[16]; va_list args; diff --git a/src/libstrongswan/settings/settings.h b/src/libstrongswan/settings/settings.h index a133a3681..eec5ece6c 100644 --- a/src/libstrongswan/settings/settings.h +++ b/src/libstrongswan/settings/settings.h @@ -51,13 +51,13 @@ bool settings_value_as_bool(char *value, bool def); int settings_value_as_int(char *value, int def); /** - * Convert a string value returned by a key/value enumerator to an u_int64_t. + * Convert a string value returned by a key/value enumerator to an uint64_t. * * @see settings_t.create_key_value_enumerator() * @param value the string value * @param def the default value, if value is NULL or invalid */ -u_int64_t settings_value_as_uint64(char *value, u_int64_t def); +uint64_t settings_value_as_uint64(char *value, uint64_t def); /** * Convert a string value returned by a key/value enumerator to a double. @@ -77,7 +77,7 @@ double settings_value_as_double(char *value, double def); * @param value the string value * @param def the default value, if value is NULL or invalid */ -u_int32_t settings_value_as_time(char *value, u_int32_t def); +uint32_t settings_value_as_time(char *value, uint32_t def); /** * Generic configuration options read from a config file. @@ -203,7 +203,7 @@ struct settings_t { * @param ... argument list for key * @return value of the key (in seconds) */ - u_int32_t (*get_time)(settings_t *this, char *key, u_int32_t def, ...); + uint32_t (*get_time)(settings_t *this, char *key, uint32_t def, ...); /** * Set a string value. @@ -248,7 +248,7 @@ struct settings_t { * @param def value to set * @param ... argument list for key */ - void (*set_time)(settings_t *this, char *key, u_int32_t value, ...); + void (*set_time)(settings_t *this, char *key, uint32_t value, ...); /** * Set a default for string value. diff --git a/src/libstrongswan/settings/settings_lexer.c b/src/libstrongswan/settings/settings_lexer.c index 6e64e15a6..2151e930b 100644 --- a/src/libstrongswan/settings/settings_lexer.c +++ b/src/libstrongswan/settings/settings_lexer.c @@ -16,8 +16,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 0 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -221,6 +221,11 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + /* %if-not-reentrant */ /* %endif */ @@ -247,6 +252,13 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --yylineno;\ + }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -264,11 +276,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -388,7 +395,7 @@ static void settings_parser__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t YY_BUFFER_STATE settings_parser__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE settings_parser__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE settings_parser__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE settings_parser__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); /* %endif */ @@ -423,7 +430,7 @@ void settings_parser_free (void * ,yyscan_t yyscanner ); /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ /* Begin user sect3 */ -#define settings_parser_wrap(n) 1 +#define settings_parser_wrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define FLEX_DEBUG @@ -434,11 +441,16 @@ typedef int yy_state_type; #define yytext_ptr yytext_r +/* %% [1.5] DFA */ + /* %if-c-only Standard (non-C++) definition */ static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); +#if defined(__GNUC__) && __GNUC__ >= 3 +__attribute__((__noreturn__)) +#endif static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); /* %endif */ @@ -474,7 +486,7 @@ static yyconst flex_int16_t yy_accept[49] = 9, 9, 9, 9, 0, 7, 7, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -506,13 +518,13 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[21] = +static yyconst YY_CHAR yy_meta[21] = { 0, 1, 2, 3, 1, 4, 5, 4, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 9 } ; -static yyconst flex_int16_t yy_base[60] = +static yyconst flex_uint16_t yy_base[60] = { 0, 0, 0, 19, 38, 21, 23, 55, 0, 47, 161, 161, 50, 161, 37, 161, 161, 0, 161, 161, 0, @@ -532,7 +544,7 @@ static yyconst flex_int16_t yy_def[60] = 48, 48, 48, 48, 48, 48, 48, 48, 48 } ; -static yyconst flex_int16_t yy_nxt[182] = +static yyconst flex_uint16_t yy_nxt[182] = { 0, 8, 9, 10, 8, 9, 11, 12, 13, 8, 8, 8, 8, 14, 8, 8, 8, 8, 8, 15, 16, @@ -638,7 +650,7 @@ static void include_files(parser_helper_t *ctx); /* state used to scan quoted strings */ -#line 642 "settings/settings_lexer.c" +#line 654 "settings/settings_lexer.c" #define INITIAL 0 #define inc 1 @@ -675,7 +687,7 @@ struct yyguts_t YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; int yy_n_chars; - int yyleng_r; + yy_size_t yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -732,19 +744,23 @@ void settings_parser_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ) FILE *settings_parser_get_in (yyscan_t yyscanner ); -void settings_parser_set_in (FILE * in_str ,yyscan_t yyscanner ); +void settings_parser_set_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *settings_parser_get_out (yyscan_t yyscanner ); -void settings_parser_set_out (FILE * out_str ,yyscan_t yyscanner ); +void settings_parser_set_out (FILE * _out_str ,yyscan_t yyscanner ); -int settings_parser_get_leng (yyscan_t yyscanner ); +yy_size_t settings_parser_get_leng (yyscan_t yyscanner ); char *settings_parser_get_text (yyscan_t yyscanner ); int settings_parser_get_lineno (yyscan_t yyscanner ); -void settings_parser_set_lineno (int line_number ,yyscan_t yyscanner ); +void settings_parser_set_lineno (int _line_number ,yyscan_t yyscanner ); + +int settings_parser_get_column (yyscan_t yyscanner ); + +void settings_parser_set_column (int _column_no ,yyscan_t yyscanner ); /* %if-bison-bridge */ @@ -768,8 +784,11 @@ extern int settings_parser_wrap (yyscan_t yyscanner ); /* %not-for-header */ +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); +#endif /* %ok-for-header */ /* %endif */ @@ -798,7 +817,7 @@ static int input (yyscan_t yyscanner ); /* %if-c-only */ - static void yy_push_state (int new_state ,yyscan_t yyscanner); + static void yy_push_state (int _new_state ,yyscan_t yyscanner); static void yy_pop_state (yyscan_t yyscanner ); @@ -928,7 +947,7 @@ extern int settings_parser_lex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif /* %% [6.0] YY_RULE_SETUP definition goes here */ @@ -941,17 +960,11 @@ extern int settings_parser_lex \ */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -/* %% [7.0] user's declarations go here */ -#line 57 "settings/settings_lexer.l" - - -#line 954 "settings/settings_lexer.c" - yylval = yylval_param; if ( !yyg->yy_init ) @@ -988,7 +1001,14 @@ YY_DECL settings_parser__load_buffer_state(yyscanner ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +/* %% [7.0] user's declarations go here */ +#line 57 "settings/settings_lexer.l" + + +#line 1010 "settings/settings_lexer.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { /* %% [8.0] yymore()-related code goes here */ yy_cp = yyg->yy_c_buf_p; @@ -1006,7 +1026,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1039,7 +1059,7 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - int yyl; + yy_size_t yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) @@ -1106,6 +1126,7 @@ return yytext[0]; case 7: /* rule 7 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +YY_LINENO_REWIND_TO(yy_cp - 1); yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP @@ -1192,6 +1213,7 @@ YY_RULE_SETUP case 15: #line 121 "settings/settings_lexer.l" +YY_RULE_SETUP case YY_STATE_EOF(str): #line 121 "settings/settings_lexer.l" case 16: @@ -1267,7 +1289,7 @@ YY_RULE_SETUP #line 159 "settings/settings_lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1271 "settings/settings_lexer.c" +#line 1293 "settings/settings_lexer.c" case YY_END_OF_BUFFER: { @@ -1290,7 +1312,11 @@ YY_FATAL_ERROR( "flex scanner jammed" ); * back-up) that will match for the new input source. */ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; +/* %if-c-only */ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -1397,6 +1423,7 @@ YY_FATAL_ERROR( "flex scanner jammed" ); "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of settings_parser_lex */ /* %ok-for-header */ @@ -1421,9 +1448,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + yy_size_t number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -1452,7 +1479,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1465,21 +1492,21 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* 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) (yyg->yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1510,7 +1537,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, (size_t) num_to_read ); + yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1534,9 +1561,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) settings_parser_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -1561,8 +1588,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* %if-c++-only */ /* %endif */ { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* %% [15.0] code to get the start state into yy_current_state goes here */ @@ -1571,7 +1598,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { /* %% [16.0] code to find the next state goes here */ - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1600,12 +1627,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* %if-c++-only */ /* %endif */ { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1620,17 +1647,19 @@ static int yy_get_next_buffer (yyscan_t yyscanner) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 48); + (void)yyg; return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT /* %if-c-only */ - static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) + static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) /* %endif */ /* %if-c++-only */ /* %endif */ { - register char *yy_cp; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_cp = yyg->yy_c_buf_p; @@ -1641,10 +1670,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yyg->yy_n_chars + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + yy_size_t number_to_move = yyg->yy_n_chars + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1674,6 +1703,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* %if-c-only */ /* %endif */ +#endif /* %if-c-only */ #ifndef YY_NO_INPUT @@ -1704,7 +1734,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1787,6 +1817,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) settings_parser__load_buffer_state(yyscanner ); } +/* %if-c++-only */ +/* %endif */ + /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. @@ -1836,7 +1869,11 @@ static void settings_parser__load_buffer_state (yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; +/* %if-c-only */ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; +/* %endif */ +/* %if-c++-only */ +/* %endif */ yyg->yy_hold_char = *yyg->yy_c_buf_p; } @@ -1858,7 +1895,7 @@ static void settings_parser__load_buffer_state (yyscan_t yyscanner) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in settings_parser__create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -1874,6 +1911,9 @@ static void settings_parser__load_buffer_state (yyscan_t yyscanner) return b; } +/* %if-c++-only */ +/* %endif */ + /** Destroy the buffer. * @param b a buffer created with settings_parser__create_buffer() * @param yyscanner The scanner object. @@ -1898,17 +1938,6 @@ static void settings_parser__load_buffer_state (yyscan_t yyscanner) settings_parser_free((void *) b ,yyscanner ); } -/* %if-c-only */ - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* %endif */ - -/* %if-c++-only */ -/* %endif */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a settings_parser_restart() or at EOF. @@ -1925,7 +1954,11 @@ extern int isatty (int ); settings_parser__flush_buffer(b ,yyscanner); +/* %if-c-only */ b->yy_input_file = file; +/* %endif */ +/* %if-c++-only */ +/* %endif */ b->yy_fill_buffer = 1; /* If b is the current buffer, then settings_parser__init_buffer was _probably_ @@ -2055,7 +2088,7 @@ static void settings_parser_ensure_buffer_stack (yyscan_t yyscanner) /* %if-c++-only */ /* %endif */ { - int num_to_alloc; + yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -2064,7 +2097,7 @@ static void settings_parser_ensure_buffer_stack (yyscan_t yyscanner) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)settings_parser_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); @@ -2081,7 +2114,7 @@ static void settings_parser_ensure_buffer_stack (yyscan_t yyscanner) if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)settings_parser_realloc @@ -2159,12 +2192,12 @@ YY_BUFFER_STATE settings_parser__scan_string (yyconst char * yystr , yyscan_t yy * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE settings_parser__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE settings_parser__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2191,7 +2224,7 @@ YY_BUFFER_STATE settings_parser__scan_bytes (yyconst char * yybytes, int _yyby /* %endif */ /* %if-c-only */ - static void yy_push_state (int new_state , yyscan_t yyscanner) + static void yy_push_state (int _new_state , yyscan_t yyscanner) /* %endif */ /* %if-c++-only */ /* %endif */ @@ -2216,7 +2249,7 @@ YY_BUFFER_STATE settings_parser__scan_bytes (yyconst char * yybytes, int _yyby yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; - BEGIN(new_state); + BEGIN(_new_state); } /* %if-c-only */ @@ -2249,7 +2282,9 @@ YY_BUFFER_STATE settings_parser__scan_bytes (yyconst char * yybytes, int _yyby /* %if-c-only */ static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { - (void) fprintf( stderr, "%s\n", msg ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* %endif */ @@ -2336,7 +2371,7 @@ FILE *settings_parser_get_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int settings_parser_get_leng (yyscan_t yyscanner) +yy_size_t settings_parser_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2367,51 +2402,51 @@ void settings_parser_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner /* %endif */ /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void settings_parser_set_lineno (int line_number , yyscan_t yyscanner) +void settings_parser_set_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "settings_parser_set_lineno called with no buffer" , yyscanner); + YY_FATAL_ERROR( "settings_parser_set_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param line_number + * @param _column_no column number * @param yyscanner The scanner object. */ -void settings_parser_set_column (int column_no , yyscan_t yyscanner) +void settings_parser_set_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "settings_parser_set_column called with no buffer" , yyscanner); + YY_FATAL_ERROR( "settings_parser_set_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see settings_parser__switch_to_buffer */ -void settings_parser_set_in (FILE * in_str , yyscan_t yyscanner) +void settings_parser_set_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void settings_parser_set_out (FILE * out_str , yyscan_t yyscanner) +void settings_parser_set_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int settings_parser_get_debug (yyscan_t yyscanner) @@ -2420,10 +2455,10 @@ int settings_parser_get_debug (yyscan_t yyscanner) return yy_flex_debug; } -void settings_parser_set_debug (int bdebug , yyscan_t yyscanner) +void settings_parser_set_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* %endif */ @@ -2589,7 +2624,10 @@ int settings_parser_lex_destroy (yyscan_t yyscanner) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { - register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2598,7 +2636,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2608,11 +2646,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) void *settings_parser_alloc (yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; return (void *) malloc( size ); } void *settings_parser_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2625,6 +2668,8 @@ void *settings_parser_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner void settings_parser_free (void * ptr , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; free( (char *) ptr ); /* see settings_parser_realloc() for (char *) cast */ } diff --git a/src/libstrongswan/settings/settings_parser.c b/src/libstrongswan/settings/settings_parser.c index 6cd3b177a..47cf8ebd4 100644 --- a/src/libstrongswan/settings/settings_parser.c +++ b/src/libstrongswan/settings/settings_parser.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -180,7 +180,7 @@ extern int settings_parser_debug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { #line 77 "settings/settings_parser.y" /* yacc.c:355 */ @@ -191,6 +191,8 @@ union YYSTYPE #line 193 "settings/settings_parser.c" /* yacc.c:355 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -203,7 +205,7 @@ int settings_parser_parse (parser_helper_t *ctx); /* Copy the second part of user declarations. */ -#line 207 "settings/settings_parser.c" /* yacc.c:358 */ +#line 209 "settings/settings_parser.c" /* yacc.c:358 */ #ifdef short # undef short @@ -1027,43 +1029,43 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_helper_t *c case 3: /* NAME */ #line 91 "settings/settings_parser.y" /* yacc.c:1257 */ { free(((*yyvaluep).s)); } -#line 1031 "settings/settings_parser.c" /* yacc.c:1257 */ +#line 1033 "settings/settings_parser.c" /* yacc.c:1257 */ break; case 4: /* STRING */ #line 91 "settings/settings_parser.y" /* yacc.c:1257 */ { free(((*yyvaluep).s)); } -#line 1037 "settings/settings_parser.c" /* yacc.c:1257 */ +#line 1039 "settings/settings_parser.c" /* yacc.c:1257 */ break; case 13: /* section */ #line 93 "settings/settings_parser.y" /* yacc.c:1257 */ { pop_section(ctx); settings_section_destroy(((*yyvaluep).sec), NULL); } -#line 1043 "settings/settings_parser.c" /* yacc.c:1257 */ +#line 1045 "settings/settings_parser.c" /* yacc.c:1257 */ break; case 14: /* section_start */ #line 93 "settings/settings_parser.y" /* yacc.c:1257 */ { pop_section(ctx); settings_section_destroy(((*yyvaluep).sec), NULL); } -#line 1049 "settings/settings_parser.c" /* yacc.c:1257 */ +#line 1051 "settings/settings_parser.c" /* yacc.c:1257 */ break; case 15: /* setting */ #line 94 "settings/settings_parser.y" /* yacc.c:1257 */ { settings_kv_destroy(((*yyvaluep).kv), NULL); } -#line 1055 "settings/settings_parser.c" /* yacc.c:1257 */ +#line 1057 "settings/settings_parser.c" /* yacc.c:1257 */ break; case 16: /* value */ #line 91 "settings/settings_parser.y" /* yacc.c:1257 */ { free(((*yyvaluep).s)); } -#line 1061 "settings/settings_parser.c" /* yacc.c:1257 */ +#line 1063 "settings/settings_parser.c" /* yacc.c:1257 */ break; case 17: /* valuepart */ #line 91 "settings/settings_parser.y" /* yacc.c:1257 */ { free(((*yyvaluep).s)); } -#line 1067 "settings/settings_parser.c" /* yacc.c:1257 */ +#line 1069 "settings/settings_parser.c" /* yacc.c:1257 */ break; @@ -1333,7 +1335,7 @@ yyreduce: { add_section(ctx, (yyvsp[0].sec)); } -#line 1337 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1339 "settings/settings_parser.c" /* yacc.c:1646 */ break; case 6: @@ -1341,7 +1343,7 @@ yyreduce: { add_setting(ctx, (yyvsp[0].kv)); } -#line 1345 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1347 "settings/settings_parser.c" /* yacc.c:1646 */ break; case 7: @@ -1350,7 +1352,7 @@ yyreduce: pop_section(ctx); (yyval.sec) = (yyvsp[-2].sec); } -#line 1354 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1356 "settings/settings_parser.c" /* yacc.c:1646 */ break; case 8: @@ -1358,7 +1360,7 @@ yyreduce: { (yyval.sec) = push_section(ctx, (yyvsp[-1].s)); } -#line 1362 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1364 "settings/settings_parser.c" /* yacc.c:1646 */ break; case 9: @@ -1366,7 +1368,7 @@ yyreduce: { (yyval.sec) = push_section(ctx, (yyvsp[-2].s)); } -#line 1370 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1372 "settings/settings_parser.c" /* yacc.c:1646 */ break; case 10: @@ -1374,7 +1376,7 @@ yyreduce: { (yyval.kv) = settings_kv_create((yyvsp[-2].s), (yyvsp[0].s)); } -#line 1378 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1380 "settings/settings_parser.c" /* yacc.c:1646 */ break; case 11: @@ -1382,7 +1384,7 @@ yyreduce: { (yyval.kv) = settings_kv_create((yyvsp[-1].s), NULL); } -#line 1386 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1388 "settings/settings_parser.c" /* yacc.c:1646 */ break; case 13: @@ -1397,11 +1399,11 @@ yyreduce: free((yyvsp[-1].s)); free((yyvsp[0].s)); } -#line 1401 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1403 "settings/settings_parser.c" /* yacc.c:1646 */ break; -#line 1405 "settings/settings_parser.c" /* yacc.c:1646 */ +#line 1407 "settings/settings_parser.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/src/libstrongswan/settings/settings_parser.h b/src/libstrongswan/settings/settings_parser.h index d887777a2..b41e0d56f 100644 --- a/src/libstrongswan/settings/settings_parser.h +++ b/src/libstrongswan/settings/settings_parser.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,7 +59,7 @@ extern int settings_parser_debug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { #line 77 "settings/settings_parser.y" /* yacc.c:1909 */ @@ -70,6 +70,8 @@ union YYSTYPE #line 72 "settings/settings_parser.h" /* yacc.c:1909 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif |