diff options
author | Haru <haru@dotalux.com> | 2016-02-16 16:59:09 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-02-17 10:39:53 +0100 |
commit | d38019541508d0efb3477ef4938ea8e939444333 (patch) | |
tree | 095efa7663585f56bcf3fa2f641a0e1f633f10d6 /3rdparty/libconfig/scanner.c | |
parent | 1bfb8c1283a0c662902cc8cb94d30159a9bc1183 (diff) | |
download | hercules-d38019541508d0efb3477ef4938ea8e939444333.tar.gz hercules-d38019541508d0efb3477ef4938ea8e939444333.tar.bz2 hercules-d38019541508d0efb3477ef4938ea8e939444333.tar.xz hercules-d38019541508d0efb3477ef4938ea8e939444333.zip |
Updated libconfig to version 1.5
- Based on https://github.com/hyperrealm/libconfig/releases/tag/v1.5
f9f23d7a95608936ea7d839731dbd56f1667b7ed
- Improvements that come with this libconfig version:
* Don't fclose() a null pointer.
* check if file being opened is a directory
* added config_set_options(), config_get_options(), setOptions(),
getOptions().
* renamed config_setting_lookup_from() to config_setting_lookup() and
documented it
* floating point precision loss patch
* scanner code cleanup
* parser code cleanup
* bugfix; capture root filename
- Parser generated with Bison 2.7
- Scanner generated with flex 2.6
- This includes the windows-compatibility commit
909b06c07e30e456cc63f58d31b0e2f3aad4cc43 from upstream (although not
part of version 1.5)
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to '3rdparty/libconfig/scanner.c')
-rw-r--r-- | 3rdparty/libconfig/scanner.c | 280 |
1 files changed, 161 insertions, 119 deletions
diff --git a/3rdparty/libconfig/scanner.c b/3rdparty/libconfig/scanner.c index 96c01fc5f..abe173830 100644 --- a/3rdparty/libconfig/scanner.c +++ b/3rdparty/libconfig/scanner.c @@ -1,10 +1,6 @@ #line 2 "scanner.c" -#line 36 "scanner.l" -#include "scanctx.h" - - -#line 8 "scanner.c" +#line 4 "scanner.c" #define YY_INT_ALIGNED short int @@ -12,8 +8,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 0 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -163,7 +159,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -348,7 +352,7 @@ void libconfig_yyfree (void * ,yyscan_t yyscanner ); #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) -#define libconfig_yywrap(yyscanner) 1 +#define libconfig_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -360,6 +364,9 @@ typedef int yy_state_type; 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 ); /* Done after the current pattern has been matched and before the @@ -399,7 +406,7 @@ static yyconst flex_int16_t yy_accept[123] = 19, 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, 4, 5, 1, 1, 1, 1, 1, 1, 1, @@ -431,7 +438,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[51] = +static yyconst YY_CHAR yy_meta[51] = { 0, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 3, 1, 1, 3, 3, 1, 4, 4, 1, 1, @@ -440,7 +447,7 @@ static yyconst flex_int32_t yy_meta[51] = 4, 4, 3, 3, 3, 3, 3, 3, 1, 1 } ; -static yyconst flex_int16_t yy_base[134] = +static yyconst flex_uint16_t yy_base[134] = { 0, 0, 49, 49, 50, 48, 49, 50, 51, 244, 243, 248, 251, 245, 251, 251, 251, 243, 251, 251, 0, @@ -478,7 +485,7 @@ static yyconst flex_int16_t yy_def[134] = 122, 122, 122 } ; -static yyconst flex_int16_t yy_nxt[302] = +static yyconst flex_uint16_t yy_nxt[302] = { 0, 12, 13, 14, 15, 15, 16, 17, 12, 18, 19, 20, 21, 22, 21, 23, 24, 25, 26, 27, 28, @@ -572,7 +579,8 @@ static yyconst flex_int32_t yy_rule_can_match_eol[46] = /* -*- mode: C -*- */ /* -------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2005-2010 Mark A Lindner + Copyright (C) 2013-2016 Hercules Dev Team + Copyright (C) 2005-2014 Mark A Lindner This file is part of libconfig. @@ -592,20 +600,20 @@ static yyconst flex_int32_t yy_rule_can_match_eol[46] = ---------------------------------------------------------------------------- */ #define YY_NO_UNISTD_H 1 +#line 37 "scanner.l" -#line 40 "scanner.l" #ifdef _MSC_VER #pragma warning (disable: 4996) -/* disable MSVC warning "signed/unsigned mismatch" associated with code generated by flex versions such as 2.5.35. */ -#pragma warning (disable:4018) #endif #include <stdlib.h> #include <ctype.h> #include <string.h> +#include <limits.h> +#include "parsectx.h" +#include "scanctx.h" #include "grammar.h" #include "wincompat.h" -#include "parsectx.h" #define YY_NO_INPUT // Suppress generation of useless input() function @@ -643,15 +651,8 @@ static unsigned long long fromhex(const char *s) #endif /* __MINGW32__ */ } -static int fromihex(const char *s) { - unsigned long l = strtoul(s, NULL, 16); - if (l > INT32_MAX) - l &= INT32_MAX; - return (int)l; -} - -#line 655 "scanner.c" +#line 656 "scanner.c" #define INITIAL 0 #define COMMENT 1 @@ -722,11 +723,11 @@ void libconfig_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *libconfig_yyget_in (yyscan_t yyscanner ); -void libconfig_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void libconfig_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *libconfig_yyget_out (yyscan_t yyscanner ); -void libconfig_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void libconfig_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); yy_size_t libconfig_yyget_leng (yyscan_t yyscanner ); @@ -734,11 +735,11 @@ char *libconfig_yyget_text (yyscan_t yyscanner ); int libconfig_yyget_lineno (yyscan_t yyscanner ); -void libconfig_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void libconfig_yyset_lineno (int _line_number ,yyscan_t yyscanner ); int libconfig_yyget_column (yyscan_t yyscanner ); -void libconfig_yyset_column (int column_no ,yyscan_t yyscanner ); +void libconfig_yyset_column (int _column_no ,yyscan_t yyscanner ); YYSTYPE * libconfig_yyget_lval (yyscan_t yyscanner ); @@ -756,6 +757,10 @@ extern int libconfig_yywrap (yyscan_t yyscanner ); #endif #endif +#ifndef YY_NO_UNPUT + +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif @@ -776,7 +781,12 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -865,7 +875,7 @@ extern int libconfig_yylex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -878,9 +888,9 @@ extern int libconfig_yylex \ */ 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; yylval = yylval_param; @@ -912,12 +922,12 @@ YY_DECL } { -#line 112 "scanner.l" +#line 103 "scanner.l" -#line 919 "scanner.c" +#line 929 "scanner.c" - while ( 1 ) /* loops until end-of-file is reached */ + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; @@ -934,7 +944,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; @@ -983,69 +993,69 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 114 "scanner.l" +#line 105 "scanner.l" { BEGIN COMMENT; } YY_BREAK case 2: YY_RULE_SETUP -#line 115 "scanner.l" +#line 106 "scanner.l" { BEGIN INITIAL; } YY_BREAK case 3: YY_RULE_SETUP -#line 116 "scanner.l" +#line 107 "scanner.l" { /* ignore */ } YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 117 "scanner.l" +#line 108 "scanner.l" { /* ignore */ } YY_BREAK case 5: YY_RULE_SETUP -#line 119 "scanner.l" +#line 110 "scanner.l" { BEGIN STRING; } YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 120 "scanner.l" +#line 111 "scanner.l" { scanctx_append_string(yyextra, yytext); } YY_BREAK case 7: YY_RULE_SETUP -#line 121 "scanner.l" +#line 112 "scanner.l" { scanctx_append_string(yyextra, "\n"); } YY_BREAK case 8: YY_RULE_SETUP -#line 122 "scanner.l" +#line 113 "scanner.l" { scanctx_append_string(yyextra, "\r"); } YY_BREAK case 9: YY_RULE_SETUP -#line 123 "scanner.l" +#line 114 "scanner.l" { scanctx_append_string(yyextra, "\t"); } YY_BREAK case 10: YY_RULE_SETUP -#line 124 "scanner.l" +#line 115 "scanner.l" { scanctx_append_string(yyextra, "\f"); } YY_BREAK case 11: YY_RULE_SETUP -#line 125 "scanner.l" +#line 116 "scanner.l" { scanctx_append_string(yyextra, "\\"); } YY_BREAK case 12: YY_RULE_SETUP -#line 126 "scanner.l" +#line 117 "scanner.l" { scanctx_append_string(yyextra, "\""); } YY_BREAK case 13: YY_RULE_SETUP -#line 127 "scanner.l" +#line 118 "scanner.l" { char c[2] = { (char)(strtol(yytext + 2, NULL, 16) & 0xFF), 0 }; @@ -1054,12 +1064,12 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 132 "scanner.l" +#line 123 "scanner.l" { scanctx_append_string(yyextra, "\\"); } YY_BREAK case 15: YY_RULE_SETUP -#line 133 "scanner.l" +#line 124 "scanner.l" { yylval->sval = scanctx_take_string(yyextra); BEGIN INITIAL; @@ -1068,18 +1078,18 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 139 "scanner.l" +#line 130 "scanner.l" { BEGIN SCRIPTBLOCK; } YY_BREAK case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 140 "scanner.l" +#line 131 "scanner.l" { scanctx_append_string(yyextra, yytext); } YY_BREAK case 18: YY_RULE_SETUP -#line 141 "scanner.l" +#line 132 "scanner.l" { yylval->sval = scanctx_take_string(yyextra); BEGIN INITIAL; @@ -1088,28 +1098,28 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 147 "scanner.l" +#line 138 "scanner.l" { BEGIN INCLUDE; } YY_BREAK case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 148 "scanner.l" +#line 139 "scanner.l" { scanctx_append_string(yyextra, yytext); } YY_BREAK case 21: YY_RULE_SETUP -#line 149 "scanner.l" +#line 140 "scanner.l" { scanctx_append_string(yyextra, "\\"); } YY_BREAK case 22: YY_RULE_SETUP -#line 150 "scanner.l" +#line 141 "scanner.l" { scanctx_append_string(yyextra, "\""); } YY_BREAK case 23: YY_RULE_SETUP -#line 151 "scanner.l" +#line 142 "scanner.l" { const char *error; FILE *fp = scanctx_push_include(yyextra, @@ -1135,97 +1145,116 @@ YY_RULE_SETUP case 24: /* rule 24 can match eol */ YY_RULE_SETUP -#line 175 "scanner.l" +#line 166 "scanner.l" { /* ignore */ } YY_BREAK case 25: YY_RULE_SETUP -#line 176 "scanner.l" +#line 167 "scanner.l" { /* ignore */ } YY_BREAK case 26: YY_RULE_SETUP -#line 178 "scanner.l" +#line 169 "scanner.l" { return(TOK_EQUALS); } YY_BREAK case 27: YY_RULE_SETUP -#line 179 "scanner.l" +#line 170 "scanner.l" { return(TOK_COMMA); } YY_BREAK case 28: YY_RULE_SETUP -#line 180 "scanner.l" +#line 171 "scanner.l" { return(TOK_GROUP_START); } YY_BREAK case 29: YY_RULE_SETUP -#line 181 "scanner.l" +#line 172 "scanner.l" { return(TOK_GROUP_END); } YY_BREAK case 30: YY_RULE_SETUP -#line 182 "scanner.l" +#line 173 "scanner.l" { yylval->ival = 1; return(TOK_BOOLEAN); } YY_BREAK case 31: YY_RULE_SETUP -#line 183 "scanner.l" +#line 174 "scanner.l" { yylval->ival = 0; return(TOK_BOOLEAN); } YY_BREAK case 32: YY_RULE_SETUP -#line 184 "scanner.l" +#line 175 "scanner.l" { yylval->fval = atof(yytext); return(TOK_FLOAT); } YY_BREAK case 33: YY_RULE_SETUP -#line 185 "scanner.l" -{ yylval->ival = atoi(yytext); return(TOK_INTEGER); } +#line 176 "scanner.l" +{ + long long llval; + llval = atoll(yytext); + if((llval < INT_MIN) || (llval > INT_MAX)) + { + yylval->llval = llval; + return(TOK_INTEGER64); + } + else + { + yylval->ival = (int)llval; + return(TOK_INTEGER); + } + } YY_BREAK case 34: YY_RULE_SETUP -#line 186 "scanner.l" +#line 190 "scanner.l" { yylval->llval = atoll(yytext); return(TOK_INTEGER64); } YY_BREAK case 35: YY_RULE_SETUP -#line 187 "scanner.l" -{ yylval->ival = fromihex(yytext); return(TOK_HEX); } +#line 191 "scanner.l" +{ + unsigned long ulval = strtoul(yytext, NULL, 16); + if (ulval > INT32_MAX) + ulval &= INT32_MAX; + yylval->ival = (int)ulval; + return(TOK_HEX); + } YY_BREAK case 36: YY_RULE_SETUP -#line 188 "scanner.l" +#line 198 "scanner.l" { yylval->llval = fromhex(yytext); return(TOK_HEX64); } YY_BREAK case 37: YY_RULE_SETUP -#line 189 "scanner.l" +#line 199 "scanner.l" { yylval->sval = yytext; return(TOK_NAME); } YY_BREAK case 38: YY_RULE_SETUP -#line 190 "scanner.l" +#line 200 "scanner.l" { return(TOK_ARRAY_START); } YY_BREAK case 39: YY_RULE_SETUP -#line 191 "scanner.l" +#line 201 "scanner.l" { return(TOK_ARRAY_END); } YY_BREAK case 40: YY_RULE_SETUP -#line 192 "scanner.l" +#line 202 "scanner.l" { return(TOK_LIST_START); } YY_BREAK case 41: YY_RULE_SETUP -#line 193 "scanner.l" +#line 203 "scanner.l" { return(TOK_LIST_END); } YY_BREAK case 42: YY_RULE_SETUP -#line 194 "scanner.l" +#line 204 "scanner.l" { return(TOK_SEMICOLON); } YY_BREAK case 43: @@ -1233,12 +1262,12 @@ case 43: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 195 "scanner.l" +#line 205 "scanner.l" { /* ignore */ } YY_BREAK case 44: YY_RULE_SETUP -#line 196 "scanner.l" +#line 206 "scanner.l" { return(TOK_GARBAGE); } YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1246,7 +1275,7 @@ case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(STRING): case YY_STATE_EOF(INCLUDE): case YY_STATE_EOF(SCRIPTBLOCK): -#line 198 "scanner.l" +#line 208 "scanner.l" { YY_BUFFER_STATE buf = (YY_BUFFER_STATE)scanctx_pop_include( yyextra); @@ -1261,10 +1290,10 @@ case YY_STATE_EOF(SCRIPTBLOCK): YY_BREAK case 45: YY_RULE_SETUP -#line 209 "scanner.l" +#line 219 "scanner.l" ECHO; YY_BREAK -#line 1268 "scanner.c" +#line 1297 "scanner.c" case YY_END_OF_BUFFER: { @@ -1407,9 +1436,9 @@ ECHO; static int yy_get_next_buffer (yyscan_t yyscanner) { 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] ) @@ -1438,7 +1467,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++); @@ -1520,8 +1549,6 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; -#ifndef __clang_analyzer__ - // FIXME: Clang's static analyzer complains about leaking the result of libconfig_yyrealloc if ((yy_size_t) (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); @@ -1529,7 +1556,6 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } -#endif // __clang_analyzer__ yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; @@ -1544,8 +1570,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - 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; yy_current_state = yyg->yy_start; @@ -1553,7 +1579,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 ) { - 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; @@ -1578,11 +1604,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - 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. */ - 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; @@ -1601,6 +1627,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -1762,7 +1792,7 @@ static void libconfig_yy_load_buffer_state (yyscan_t yyscanner) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in libconfig_yy_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. @@ -1923,7 +1953,7 @@ static void libconfig_yyensure_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**)libconfig_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); @@ -1940,7 +1970,7 @@ static void libconfig_yyensure_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**)libconfig_yyrealloc @@ -2048,7 +2078,9 @@ YY_BUFFER_STATE libconfig_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yy 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 ); } @@ -2154,10 +2186,10 @@ void libconfig_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) } /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void libconfig_yyset_lineno (int line_number , yyscan_t yyscanner) +void libconfig_yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2165,14 +2197,14 @@ void libconfig_yyset_lineno (int line_number , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "libconfig_yyset_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 libconfig_yyset_column (int column_no , yyscan_t yyscanner) +void libconfig_yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2180,25 +2212,25 @@ void libconfig_yyset_column (int column_no , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "libconfig_yyset_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 libconfig_yy_switch_to_buffer */ -void libconfig_yyset_in (FILE * in_str , yyscan_t yyscanner) +void libconfig_yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void libconfig_yyset_out (FILE * out_str , yyscan_t yyscanner) +void libconfig_yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int libconfig_yyget_debug (yyscan_t yyscanner) @@ -2207,10 +2239,10 @@ int libconfig_yyget_debug (yyscan_t yyscanner) return yy_flex_debug; } -void libconfig_yyset_debug (int bdebug , yyscan_t yyscanner) +void libconfig_yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ @@ -2361,7 +2393,10 @@ int libconfig_yylex_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]; } @@ -2370,7 +2405,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 ) ; @@ -2380,11 +2415,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) void *libconfig_yyalloc (yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; return (void *) malloc( size ); } void *libconfig_yyrealloc (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 @@ -2397,9 +2437,11 @@ void *libconfig_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) void libconfig_yyfree (void * ptr , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; free( (char *) ptr ); /* see libconfig_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 209 "scanner.l" +#line 219 "scanner.l" |