From d38019541508d0efb3477ef4938ea8e939444333 Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 16 Feb 2016 16:59:09 +0100 Subject: 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 --- 3rdparty/libconfig/AUTHORS | 1 + 3rdparty/libconfig/ChangeLog | 38 +++ 3rdparty/libconfig/README.md | 4 + 3rdparty/libconfig/extra/doc/libconfig.texi | 192 ++++++++++-- 3rdparty/libconfig/extra/gen/clangwarnings.patch | 25 +- 3rdparty/libconfig/extra/gen/grammar.y | 6 +- 3rdparty/libconfig/extra/gen/scanner.l | 47 +-- 3rdparty/libconfig/grammar.c | 384 +++++++++++------------ 3rdparty/libconfig/grammar.h | 39 ++- 3rdparty/libconfig/libconfig-1.4.9 | 0 3rdparty/libconfig/libconfig-1.5 | 2 + 3rdparty/libconfig/libconfig.c | 194 +++++++----- 3rdparty/libconfig/libconfig.h | 21 +- 3rdparty/libconfig/parsectx.h | 4 +- 3rdparty/libconfig/scanctx.c | 11 +- 3rdparty/libconfig/scanctx.h | 4 +- 3rdparty/libconfig/scanner.c | 280 ++++++++++------- 3rdparty/libconfig/scanner.h | 37 ++- 3rdparty/libconfig/strbuf.c | 5 +- 3rdparty/libconfig/strbuf.h | 4 +- 3rdparty/libconfig/win32/stdint.h | 221 +++++++++++++ 3rdparty/libconfig/wincompat.h | 15 +- 22 files changed, 1019 insertions(+), 515 deletions(-) create mode 100644 3rdparty/libconfig/README.md delete mode 100644 3rdparty/libconfig/libconfig-1.4.9 create mode 100644 3rdparty/libconfig/libconfig-1.5 create mode 100644 3rdparty/libconfig/win32/stdint.h (limited to '3rdparty/libconfig') diff --git a/3rdparty/libconfig/AUTHORS b/3rdparty/libconfig/AUTHORS index d3d5e104b..5eef0f0ff 100644 --- a/3rdparty/libconfig/AUTHORS +++ b/3rdparty/libconfig/AUTHORS @@ -4,3 +4,4 @@ Mark Lindner - Lead developer & maintainer. Daniel Marjamäki - Enhancements & bugfixes. Andrew Tytula - Windows port. Glenn Herteg - Enhancements, bugfixes, documentation corrections. +Matt Renaud - Enhancements & bugfixes. diff --git a/3rdparty/libconfig/ChangeLog b/3rdparty/libconfig/ChangeLog index 52125e9fb..c24151e09 100644 --- a/3rdparty/libconfig/ChangeLog +++ b/3rdparty/libconfig/ChangeLog @@ -1,3 +1,41 @@ + + ----- version 1.5 ------ + +2015-05-16 Mark Lindner + + * lib/libconfig.c - Don't fclose() a null pointer. + +2014-09-19 Mark Lindner + + * lib/libconfig.c, lib/wincompat.h - check if file being opened is a + directory + * lib/libconfig.c, lib/libconfig.h, lib/libconfig.h++, + doc/libconfig.texi - added config_set_options(), + config_get_options(), setOptions(), getOptions(). + +2014-05-25 Mark Lindner + + * lib/libconfig.c++, lib/libconfig.h++ - added patches from Matt + Renaud (added iterators, removed throws() specifications); added + Setting.lookup(); code cleanup; added patch from Yuri Dyachenko + (made exception constructors public) + * lib/libconfig.c, lib/libconfig.h - renamed + config_setting_lookup_from() to config_setting_lookup() and + documented it; patch from Alexander Klauer (floating point precision + loss) + * doc/libconfig.texi - documented new APIs, bumped version + * lib/scanner.c, lib/scanner.h, lib/scanner.l, libconfig.c - + scanner code cleanup; and regenerated with flex 2.5.39 + * lib/grammar.c, lib/grammar.h, lib/grammar.y - parser code cleanup; + and regenerated with bison 3.0.2 + * README, ChangeLog - version updates + +2014-01-21 Mark Lindner + + * lib/libconfig.c - bugfix; capture root filename + * tests/Makefile.am - fix for out-of-source builds + * ac_config.h.in, aclocal.m4 - updated to newer autotools + ----- version 1.4.9 ------ 2012-09-28 Mark Lindner diff --git a/3rdparty/libconfig/README.md b/3rdparty/libconfig/README.md new file mode 100644 index 000000000..43bd17e41 --- /dev/null +++ b/3rdparty/libconfig/README.md @@ -0,0 +1,4 @@ +libconfig +========= + +C/C++ library for processing configuration files diff --git a/3rdparty/libconfig/extra/doc/libconfig.texi b/3rdparty/libconfig/extra/doc/libconfig.texi index 52dca20fc..9441dc2ac 100644 --- a/3rdparty/libconfig/extra/doc/libconfig.texi +++ b/3rdparty/libconfig/extra/doc/libconfig.texi @@ -6,8 +6,8 @@ @setfilename libconfig.info @settitle libconfig -@set edition 1.4.9 -@set update-date 28 September 2012 +@set edition 1.5 +@set update-date 16 May 2015 @set subtitle-text A Library For Processing Structured Configuration Files @set author-text Mark A.@: Lindner @@ -36,7 +36,7 @@ @page @vskip 0pt plus 1filll -Copyright @copyright{} 2005-2012 Mark A Lindner +Copyright @copyright{} 2005-2014 Mark A Lindner Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -512,8 +512,11 @@ more hexadecimal digits (@samp{0} - @samp{9}, @samp{A} - @samp{F}, @section 64-bit Integer Values Long long (64-bit) integers are represented identically to integers, -except that an 'L' character is appended to indicate a 64-bit -value. For example, @samp{0L} indicates a 64-bit integer value 0. +except that an `L' character is appended to indicate a 64-bit +value. For example, @samp{0L} indicates a 64-bit integer value 0. As +of version 1.5 of the library, the trailing `L' is optional; if the +integer value exceeds the range of a 32-bit integer, it will +automatically be interpreted as a 64-bit integer. @node Floating Point Values, Boolean Values, 64-bit Integer Values, Configuration Files @comment node-name, next, previous, up @@ -766,21 +769,60 @@ configuration @var{config}, or @code{NULL} if none is set. @end deftypefun -@deftypefun void config_set_auto_convert (@w{config_t *@var{config}}, @w{int @var{flag}}) -@deftypefunx int config_get_auto_convert (@w{const config_t *@var{config}}) +@deftypefun void config_set_options (@w{config_t *@var{config}}, @w{int @var{options}}) +@deftypefunx int config_get_options (@w{config_t *@var{config}}) + +These functions set and get the options for the configuration +@var{config}. The options affect how configurations are read and +written. The following options are defined: + +@table @code -@code{config_set_auto_convert()} enables number auto-conversion for -the configuration @var{config} if @var{flag} is non-zero, and disables -it otherwise. When this feature is enabled, an attempt to retrieve a +@item CONFIG_OPTION_AUTOCONVERT +Turning this option on enables number auto-conversion for +the configuration. When this feature is enabled, an attempt to retrieve a floating point setting's value into an integer (or vice versa), or store an integer to a floating point setting's value (or vice versa) will cause the library to silently perform the necessary conversion (possibly leading to loss of data), rather than reporting failure. By -default this feature is disabled. +default this option is turned off. + +@item CONFIG_OPTION_SEMICOLON_SEPARATORS +This option controls whether a semicolon (`;') is output after each setting +when the configuration is written to a file or stream. (The semicolon +separators are optional in the configuration syntax.) By default this +option is turned on. + +@item CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS +This option controls whether a colon (`:') is output between each +group setting's name and its value when the configuration is written to +a file or stream. If the option is turned off, an equals sign (`=') is +output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned on. + +@item CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS +This option controls whether a colon (`:') is output between each +non-group setting's name and its value when the configuration is written +to a file or stream. If the option is turned off, an equals sign (`=') +is output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned off. + +@item CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE +This option controls whether an open brace (`@{') will be written on its own +line when the configuration is written to a file or stream. If the option is +turned off, the brace will be written at the end of the previous line. +By default this option is turned on. + +@end table + +@end deftypefun + +@deftypefun void config_set_auto_convert (@w{config_t *@var{config}}, @w{int @var{flag}}) +@deftypefunx int config_get_auto_convert (@w{const config_t *@var{config}}) -@code{config_get_auto_convert()} returns @code{CONFIG_TRUE} if number -auto-conversion is currently enabled for @var{config}; otherwise it -returns @code{CONFIG_FALSE}. +These functions get and set the @code{CONFIG_OPTION_AUTO_CONVERT} +option. They are obsoleted by the @code{config_set_options()} and +@code{config_get_options()} functions described above. @end deftypefun @@ -839,6 +881,15 @@ setting was not found. @end deftypefun +@deftypefun {config_setting_t *} config_setting_lookup (@w{const config_setting_t * @var{setting}}, @w{const char * @var{path}}) + +This function locates a setting by a path @var{path} relative to +the setting @var{setting}. It returns a pointer to the +@code{config_setting_t} structure on success, or @code{NULL} if the +setting was not found. + +@end deftypefun + @deftypefun int config_setting_get_int (@w{const config_setting_t * @var{setting}}) @deftypefunx {long long} config_setting_get_int64 (@w{const config_setting_t * @var{setting}}) @deftypefunx double config_setting_get_float (@w{const config_setting_t * @var{setting}}) @@ -1146,17 +1197,45 @@ common base exception @code{ConfigException}. A @code{SettingTypeException} is thrown when the type of a setting's value does not match the type requested. +@deftypemethod SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}) +@deftypemethodx SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}, @w{int @var{index}}) +@deftypemethodx SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) + +These methods construct @code{SettingTypeException} objects for the given @var{setting} and/or member @var{index} or @var{name}. + +@end deftypemethod + @tindex SettingNotFoundException A @code{SettingNotFoundException} is thrown when a setting is not found. +@deftypemethod SettingNotFoundException {} SettingNotFoundException (@w{const Setting &@var{setting}}, @w{int @var{index}}) +@deftypemethodx SettingNotFoundException {} SettingNotFoundException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) +@deftypemethodx SettingNotFoundException {} SettingNotFoundException (@w{const char *@var{path}}) + +These methods construct @code{SettingTypeException} objects for the given @var{setting} and member @var{index} or @var{name}, or path @var{path}. + +@end deftypemethod + @tindex SettingNameException A @code{SettingNameException} is thrown when an attempt is made to add a new setting with a non-unique or invalid name. +@deftypemethod SettingNameException {} SettingNameException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) + +This method constructs a @code{SettingNameExcpetion} object for the given @var{setting} and member name @var{name}. + +@end deftypemethod + @tindex ParseException A @code{ParseException} is thrown when a parse error occurs while reading a configuration from a stream. +@deftypemethod ParseException {} ParseException (@w{const char *@var{file}}, @w{int @var{line}}, @w{const char *@var{error}}) + +This method constructs a @code{ParseException} object with the given filename @var{file}, line number @var{line}, and error message @var{error}. + +@end deftypemethod + @tindex FileIOException A @code{FileIOException} is thrown when an I/O error occurs while reading/writing a configuration from/to a file. @@ -1247,21 +1326,60 @@ configuration, or @code{NULL} if none is set. @end deftypemethod +@deftypemethod Config void setOptions (int @var{options}) +@deftypemethodx Config int getOptions () + +These methods set and get the options for the configuration. The +options affect how configurations are read and written. The following +options are defined: + +@table @code + +@item OptionAutoConvert +Turning this option on enables number auto-conversion for +the configuration. When this feature is enabled, an attempt to retrieve a +floating point setting's value into an integer (or vice versa), or +store an integer to a floating point setting's value (or vice versa) +will cause the library to silently perform the necessary conversion +(possibly leading to loss of data), rather than reporting failure. By +default this option is turned off. + +@item OptionSemicolonSeparators +This option controls whether a semicolon (`;') is output after each setting +when the configuration is written to a file or stream. (The semicolon +separators are optional in the configuration syntax.) By default this +option is turned on. + +@item OptionColonAssignmentForGroups +This option controls whether a colon (`:') is output between each +group setting's name and its value when the configuration is written to +a file or stream. If the option is turned off, an equals sign (`=') is +output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned on. + +@item OptionColonAssignmentForNonGroups +This option controls whether a colon (`:') is output between each +non-group setting's name and its value when the configuration is written +to a file or stream. If the option is turned off, an equals sign (`=') +is output instead. (These tokens are interchangeable in the configuration +syntax.) By default this option is turned off. + +@item OptionOpenBraceOnSeparateLine +This option controls whether an open brace (`@{') will be written on its own +line when the configuration is written to a file or stream. If the option is +turned off, the brace will be written at the end of the previous line. +By default this option is turned on. + +@end table + +@end deftypemethod + @deftypemethod Config void setAutoConvert (bool @var{flag}) @deftypemethodx Config bool getAutoConvert () -@code{setAutoConvert()} enables number auto-conversion for the -configuration if @var{flag} is @code{true}, and disables it -otherwise. When this feature is enabled, an attempt to assign a -floating point setting to an integer (or vice versa), or -assign an integer to a floating point setting (or vice versa) will -cause the library to silently perform the necessary conversion -(possibly leading to loss of data), rather than throwing a -@code{SettingTypeException}. By default this feature is disabled. - -@code{getAutoConvert()} returns @code{true} if number auto-conversion -is currently enabled for the configuration; otherwise it returns -@code{false}. +These methods get and set the @code{OptionAutoConvert} option. They +are obsoleted by the @code{setOptions()} and @code{getOptions()} +methods described above. @end deftypemethod @@ -1542,6 +1660,15 @@ configuration. @end deftypemethod +@deftypemethod Setting {Setting &} lookup (@w{const char * @var{path}}) +@deftypemethodx Setting {Setting &} lookup (@w{const std::string &@var{path}}) + +This function locates a setting by a path @var{path} relative to +this setting. If requested setting is not found, a +@code{SettingNotFoundException} is thrown. + +@end deftypemethod + @deftypemethod Setting bool lookupValue (@w{const char *@var{name}}, @w{bool &@var{value}}) @deftypemethodx Setting bool lookupValue (@w{const std::string &@var{name}}, @w{bool &@var{value}}) @@ -1743,6 +1870,17 @@ These methods test if the setting has a child setting with the given @var{name}. They return @code{true} if the setting exists, and @code{false} otherwise. These methods do not throw exceptions. +@end deftypemethod +@page +@deftypemethod Setting iterator begin () +@deftypemethodx Setting iterator end () +@deftypemethodx Setting const_iterator begin () +@deftypemethodx Setting const_iterator end () + +These methods return STL-style iterators that can be used to enumerate +the child settings of a given setting. If the setting is not an array, list, +or group, they throw a @code{SettingTypeException}. + @end deftypemethod @deftypemethod Setting int getLength () @@ -1878,7 +2016,7 @@ Terminals are defined below as regular expressions: @item @code{hex} @tab @code{0[Xx][0-9A-Fa-f]+} @item @code{hex64} @tab -@code{0[Xx][0-9A-Fa-f]+L(L)?} +@code{0[Xx][0-9A-Fa-f]+(L(L)?)?} @item @code{float} @tab @code{([-+]?([0-9]*)?\.[0-9]*([eE][-+]?[0-9]+)?)|([-+]([0-9]+)(\.[0-9]*)?[eE][-+]?[0-9]+)} @end multitable diff --git a/3rdparty/libconfig/extra/gen/clangwarnings.patch b/3rdparty/libconfig/extra/gen/clangwarnings.patch index 4240f84d2..c3b45ef33 100644 --- a/3rdparty/libconfig/extra/gen/clangwarnings.patch +++ b/3rdparty/libconfig/extra/gen/clangwarnings.patch @@ -11,26 +11,5 @@ index 3595578..26444f8 100644 - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg ? yymsg : "Deleting", yytype, yyvaluep, yylocationp); - switch (yytype) - { -diff --git a/scanner.c b/scanner.c -index aebd34c..c3a717f 100644 ---- a/scanner.c -+++ b/scanner.c -@@ -1500,6 +1500,8 @@ 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); -@@ -1507,6 +1509,7 @@ 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; + YYUSE (yytype); + } diff --git a/3rdparty/libconfig/extra/gen/grammar.y b/3rdparty/libconfig/extra/gen/grammar.y index 7eab74780..2e4cfa45f 100644 --- a/3rdparty/libconfig/extra/gen/grammar.y +++ b/3rdparty/libconfig/extra/gen/grammar.y @@ -1,8 +1,8 @@ /* -*- mode: C -*- */ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. @@ -23,7 +23,7 @@ */ %defines -%output="y.tab.c" +%output "y.tab.c" %pure-parser %lex-param{void *scanner} %parse-param{void *scanner} diff --git a/3rdparty/libconfig/extra/gen/scanner.l b/3rdparty/libconfig/extra/gen/scanner.l index 6bcce8116..f717ac273 100644 --- a/3rdparty/libconfig/extra/gen/scanner.l +++ b/3rdparty/libconfig/extra/gen/scanner.l @@ -1,8 +1,8 @@ /* -*- mode: C -*- */ /* -------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. @@ -23,33 +23,30 @@ */ %option nounistd +%option never-interactive %option reentrant %option noyywrap %option yylineno %option nounput %option bison-bridge -%option never-interactive %option header-file="scanner.h" %option outfile="lex.yy.c" %option extra-type="struct scan_context *" -%top{ -#include "scanctx.h" -} - %{ + #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 #include #include +#include +#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 @@ -87,13 +84,6 @@ 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; -} - %} true [Tt][Rr][Uu][Ee] @@ -183,9 +173,28 @@ include_open ^[ \t]*@include[ \t]+\" {true} { yylval->ival = 1; return(TOK_BOOLEAN); } {false} { yylval->ival = 0; return(TOK_BOOLEAN); } {float} { yylval->fval = atof(yytext); return(TOK_FLOAT); } -{integer} { yylval->ival = atoi(yytext); return(TOK_INTEGER); } +{integer} { + 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); + } + } {integer64} { yylval->llval = atoll(yytext); return(TOK_INTEGER64); } -{hex} { yylval->ival = fromihex(yytext); return(TOK_HEX); } +{hex} { + unsigned long ulval = strtoul(yytext, NULL, 16); + if (ulval > INT32_MAX) + ulval &= INT32_MAX; + yylval->ival = (int)ulval; + return(TOK_HEX); + } {hex64} { yylval->llval = fromhex(yytext); return(TOK_HEX64); } {name} { yylval->sval = yytext; return(TOK_NAME); } \[ { return(TOK_ARRAY_START); } diff --git a/3rdparty/libconfig/grammar.c b/3rdparty/libconfig/grammar.c index eb00552e2..ee1da702e 100644 --- a/3rdparty/libconfig/grammar.c +++ b/3rdparty/libconfig/grammar.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 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 "2.5" +#define YYBISON_VERSION "2.7.12-4996" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,8 +58,6 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse libconfig_yyparse @@ -70,11 +68,9 @@ #define yydebug libconfig_yydebug #define yynerrs libconfig_yynerrs - /* Copy the first part of user declarations. */ - -/* Line 268 of yacc.c */ -#line 32 "grammar.y" +/* Line 371 of yacc.c */ +#line 33 "grammar.y" #include #include @@ -126,14 +122,16 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, } +/* Line 371 of yacc.c */ +#line 127 "grammar.c" -/* Line 268 of yacc.c */ -#line 132 "grammar.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -143,11 +141,17 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "y.tab.h". */ +#ifndef YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +# define YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int libconfig_yydebug; #endif - /* Tokens. */ #ifndef YYTOKENTYPE @@ -201,13 +205,11 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { - -/* Line 293 of yacc.c */ -#line 85 "grammar.y" +/* Line 387 of yacc.c */ +#line 86 "grammar.y" int ival; long long llval; @@ -215,9 +217,8 @@ typedef union YYSTYPE char *sval; - -/* Line 293 of yacc.c */ -#line 221 "grammar.c" +/* Line 387 of yacc.c */ +#line 222 "grammar.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -225,11 +226,26 @@ typedef union YYSTYPE #endif -/* Copy the second part of user declarations. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int libconfig_yyparse (void *YYPARSE_PARAM); +#else +int libconfig_yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx); +#else +int libconfig_yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ +#endif /* !YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED */ -/* Line 343 of yacc.c */ -#line 233 "grammar.c" +/* Copy the second part of user declarations. */ + +/* Line 390 of yacc.c */ +#line 249 "grammar.c" #ifdef short # undef short @@ -282,24 +298,33 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) +# define __attribute__(Spec) /* empty */ # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif + /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(n) (n) +# define YYID(N) (N) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -335,6 +360,7 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -426,20 +452,20 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -529,15 +555,15 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 100, 100, 102, 106, 107, 110, 112, 115, 117, - 118, 121, 123, 128, 127, 147, 146, 170, 169, 192, - 193, 194, 195, 199, 200, 204, 224, 246, 268, 290, - 312, 330, 358, 359, 363, 366, 368, 372, 373, 377, - 380, 382, 387, 386 + 0, 101, 101, 103, 107, 108, 111, 113, 116, 118, + 119, 122, 124, 129, 128, 148, 147, 171, 170, 193, + 194, 195, 196, 200, 201, 205, 225, 247, 269, 291, + 313, 331, 359, 360, 364, 367, 369, 373, 374, 378, + 381, 383, 388, 387 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -551,7 +577,7 @@ static const char *const yytname[] = "setting_terminator", "comma_optional", "setting", "$@1", "array", "$@2", "list", "$@3", "value", "string", "simple_value", "value_list_sub", "value_list", "value_list_optional", "simple_value_list_sub", - "simple_value_list", "simple_value_list_optional", "group", "$@4", 0 + "simple_value_list", "simple_value_list_optional", "group", "$@4", YY_NULL }; #endif @@ -640,10 +666,10 @@ static const yytype_uint8 yytable[] = 45, 48, 47, 40, 0, 46, 0, 7 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-26)) +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-26))) -#define yytable_value_is_error(yytable_value) \ +#define yytable_value_is_error(Yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = @@ -693,62 +719,35 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (scanner, ctx, scan_ctx, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) - +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - /* This macro is provided for backward compatibility. */ - #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ - #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else @@ -801,6 +800,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx) struct scan_context *scan_ctx; #endif { + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; YYUSE (scanner); @@ -812,11 +813,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx) # else YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -1061,12 +1058,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1126,11 +1122,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1150,10 +1148,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1213,29 +1213,10 @@ yydestruct (yymsg, yytype, yyvaluep, scanner, ctx, scan_ctx) YY_SYMBOL_PRINT (yymsg ? yymsg : "Deleting", yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YYUSE (yytype); } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /*----------. @@ -1269,8 +1250,31 @@ yyparse (scanner, ctx, scan_ctx) /* The lookahead symbol. */ int yychar; + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +static YYSTYPE yyval_default; +# define YY_INITIAL_VALUE(Value) = Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1283,7 +1287,7 @@ YYSTYPE yylval; `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1301,7 +1305,7 @@ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1319,9 +1323,8 @@ YYSTYPE yylval; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1330,14 +1333,6 @@ YYSTYPE yylval; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1478,7 +1473,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1515,9 +1512,8 @@ yyreduce: switch (yyn) { case 13: - -/* Line 1806 of yacc.c */ -#line 128 "grammar.y" +/* Line 1802 of yacc.c */ +#line 129 "grammar.y" { ctx->setting = config_setting_add(ctx->parent, (yyvsp[(1) - (1)].sval), CONFIG_TYPE_NONE); @@ -1534,9 +1530,8 @@ yyreduce: break; case 15: - -/* Line 1806 of yacc.c */ -#line 147 "grammar.y" +/* Line 1802 of yacc.c */ +#line 148 "grammar.y" { if(IN_LIST()) { @@ -1553,9 +1548,8 @@ yyreduce: break; case 16: - -/* Line 1806 of yacc.c */ -#line 162 "grammar.y" +/* Line 1802 of yacc.c */ +#line 163 "grammar.y" { if(ctx->parent) ctx->parent = ctx->parent->parent; @@ -1563,9 +1557,8 @@ yyreduce: break; case 17: - -/* Line 1806 of yacc.c */ -#line 170 "grammar.y" +/* Line 1802 of yacc.c */ +#line 171 "grammar.y" { if(IN_LIST()) { @@ -1582,9 +1575,8 @@ yyreduce: break; case 18: - -/* Line 1806 of yacc.c */ -#line 185 "grammar.y" +/* Line 1802 of yacc.c */ +#line 186 "grammar.y" { if(ctx->parent) ctx->parent = ctx->parent->parent; @@ -1592,23 +1584,20 @@ yyreduce: break; case 23: - -/* Line 1806 of yacc.c */ -#line 199 "grammar.y" +/* Line 1802 of yacc.c */ +#line 200 "grammar.y" { parsectx_append_string(ctx, (yyvsp[(1) - (1)].sval)); free((yyvsp[(1) - (1)].sval)); } break; case 24: - -/* Line 1806 of yacc.c */ -#line 200 "grammar.y" +/* Line 1802 of yacc.c */ +#line 201 "grammar.y" { parsectx_append_string(ctx, (yyvsp[(2) - (2)].sval)); free((yyvsp[(2) - (2)].sval)); } break; case 25: - -/* Line 1806 of yacc.c */ -#line 205 "grammar.y" +/* Line 1802 of yacc.c */ +#line 206 "grammar.y" { if(IN_ARRAY() || IN_LIST()) { @@ -1631,9 +1620,8 @@ yyreduce: break; case 26: - -/* Line 1806 of yacc.c */ -#line 225 "grammar.y" +/* Line 1802 of yacc.c */ +#line 226 "grammar.y" { if(IN_ARRAY() || IN_LIST()) { @@ -1658,9 +1646,8 @@ yyreduce: break; case 27: - -/* Line 1806 of yacc.c */ -#line 247 "grammar.y" +/* Line 1802 of yacc.c */ +#line 248 "grammar.y" { if(IN_ARRAY() || IN_LIST()) { @@ -1685,9 +1672,8 @@ yyreduce: break; case 28: - -/* Line 1806 of yacc.c */ -#line 269 "grammar.y" +/* Line 1802 of yacc.c */ +#line 270 "grammar.y" { if(IN_ARRAY() || IN_LIST()) { @@ -1712,9 +1698,8 @@ yyreduce: break; case 29: - -/* Line 1806 of yacc.c */ -#line 291 "grammar.y" +/* Line 1802 of yacc.c */ +#line 292 "grammar.y" { if(IN_ARRAY() || IN_LIST()) { @@ -1739,9 +1724,8 @@ yyreduce: break; case 30: - -/* Line 1806 of yacc.c */ -#line 313 "grammar.y" +/* Line 1802 of yacc.c */ +#line 314 "grammar.y" { if(IN_ARRAY() || IN_LIST()) { @@ -1762,9 +1746,8 @@ yyreduce: break; case 31: - -/* Line 1806 of yacc.c */ -#line 331 "grammar.y" +/* Line 1802 of yacc.c */ +#line 332 "grammar.y" { if(IN_ARRAY() || IN_LIST()) { @@ -1792,9 +1775,8 @@ yyreduce: break; case 42: - -/* Line 1806 of yacc.c */ -#line 387 "grammar.y" +/* Line 1802 of yacc.c */ +#line 388 "grammar.y" { if(IN_LIST()) { @@ -1811,9 +1793,8 @@ yyreduce: break; case 43: - -/* Line 1806 of yacc.c */ -#line 402 "grammar.y" +/* Line 1802 of yacc.c */ +#line 403 "grammar.y" { if(ctx->parent) ctx->parent = ctx->parent->parent; @@ -1821,9 +1802,8 @@ yyreduce: break; - -/* Line 1806 of yacc.c */ -#line 1829 "grammar.c" +/* Line 1802 of yacc.c */ +#line 1809 "grammar.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1986,7 +1966,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2010,7 +1992,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2052,8 +2034,6 @@ yyreturn: } - -/* Line 2067 of yacc.c */ -#line 408 "grammar.y" - +/* Line 2050 of yacc.c */ +#line 409 "grammar.y" diff --git a/3rdparty/libconfig/grammar.h b/3rdparty/libconfig/grammar.h index d7fd02cc8..86b7b65cd 100644 --- a/3rdparty/libconfig/grammar.h +++ b/3rdparty/libconfig/grammar.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 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 @@ -30,6 +30,15 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +# define YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int libconfig_yydebug; +#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -83,13 +92,11 @@ - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { - -/* Line 2068 of yacc.c */ -#line 85 "grammar.y" +/* Line 2060 of yacc.c */ +#line 86 "grammar.y" int ival; long long llval; @@ -97,9 +104,8 @@ typedef union YYSTYPE char *sval; - -/* Line 2068 of yacc.c */ -#line 103 "grammar.h" +/* Line 2060 of yacc.c */ +#line 109 "grammar.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -107,5 +113,18 @@ typedef union YYSTYPE #endif +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int libconfig_yyparse (void *YYPARSE_PARAM); +#else +int libconfig_yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx); +#else +int libconfig_yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ - +#endif /* !YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED */ diff --git a/3rdparty/libconfig/libconfig-1.4.9 b/3rdparty/libconfig/libconfig-1.4.9 deleted file mode 100644 index e69de29bb..000000000 diff --git a/3rdparty/libconfig/libconfig-1.5 b/3rdparty/libconfig/libconfig-1.5 new file mode 100644 index 000000000..bf5328dcd --- /dev/null +++ b/3rdparty/libconfig/libconfig-1.5 @@ -0,0 +1,2 @@ +Based on https://github.com/hyperrealm/libconfig/releases/tag/v1.5 +f9f23d7a95608936ea7d839731dbd56f1667b7ed diff --git a/3rdparty/libconfig/libconfig.c b/3rdparty/libconfig/libconfig.c index 3d03ede9a..afc65dfef 100644 --- a/3rdparty/libconfig/libconfig.c +++ b/3rdparty/libconfig/libconfig.c @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. @@ -24,41 +24,46 @@ #include "ac_config.h" #endif -#include "libconfig.h" -#include "grammar.h" -#include "scanner.h" -#include "scanctx.h" -#include "parsectx.h" -#include "wincompat.h" - #include #ifdef HAVE_XLOCALE_H #include #endif +#include +#include +#include #include #include -#include +#include +#include + +#include "libconfig.h" +#include "parsectx.h" +#include "scanctx.h" +#include "wincompat.h" +#include "grammar.h" +#include "scanner.h" #define PATH_TOKENS ":/" #define CHUNK_SIZE 16 -#define FLOAT_PRECISION 10 +#define FLOAT_PRECISION DBL_DIG -#define _new(T) (T *)calloc(sizeof(T), 1) /* zeroed */ +#define _new(T) (T *)calloc(1, sizeof(T)) /* zeroed */ #define _delete(P) free((void *)(P)) /* ------------------------------------------------------------------------- */ #ifndef LIBCONFIG_STATIC -#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \ + || defined(WIN64) || defined(_WIN64)) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return(TRUE); } -#endif /* WIN32 */ +#endif /* WIN32 || WIN64 */ #endif /* LIBCONFIG_STATIC */ /* ------------------------------------------------------------------------- */ @@ -66,14 +71,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) static const char *__io_error = "file I/O error"; static void __config_list_destroy(config_list_t *list); -static void __config_write_setting(const config_setting_t *setting, - FILE *stream, int depth, - unsigned short tab_width); - -extern int libconfig_yyparse(void *scanner, struct parse_context *ctx, - struct scan_context *scan_ctx); -extern int libconfig_yylex_init_extra(struct scan_context *scan_ctx, - yyscan_t *scanner); +static void __config_write_setting(const config_t *config, + const config_setting_t *setting, + FILE *stream, int depth); /* ------------------------------------------------------------------------- */ @@ -106,6 +106,11 @@ static void __config_locale_override(void) /* ------------------------------------------------------------------------- */ +#define __config_has_option(C, O) \ + (((C)->options & (O)) != 0) + +/* ------------------------------------------------------------------------- */ + static void __config_locale_restore(void) { #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) \ @@ -169,9 +174,9 @@ static void __config_indent(FILE *stream, int depth, unsigned short w) /* ------------------------------------------------------------------------- */ -static void __config_write_value(const config_value_t *value, int type, - int format, int depth, - unsigned short tab_width, FILE *stream) +static void __config_write_value(const config_t *config, + const config_value_t *value, int type, + int format, int depth, FILE *stream) { char fbuf[64]; @@ -308,9 +313,9 @@ static void __config_write_value(const config_value_t *value, int type, for(s = list->elements; len--; s++) { - __config_write_value(&((*s)->value), (*s)->type, - config_setting_get_format(*s), - depth + 1, tab_width, stream); + __config_write_value(config, &((*s)->value), (*s)->type, + config_setting_get_format(*s), depth + 1, + stream); if(len) fputc(',', stream); @@ -337,9 +342,9 @@ static void __config_write_value(const config_value_t *value, int type, for(s = list->elements; len--; s++) { - __config_write_value(&((*s)->value), (*s)->type, - config_setting_get_format(*s), - depth + 1, tab_width, stream); + __config_write_value(config, &((*s)->value), (*s)->type, + config_setting_get_format(*s), depth + 1, + stream); if(len) fputc(',', stream); @@ -359,14 +364,14 @@ static void __config_write_value(const config_value_t *value, int type, if(depth > 0) { -#ifdef K_AND_R_STYLE /* Horrendous, but many people like it. */ - fputc(' ', stream); -#else - fputc('\n', stream); + if((config->options & CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE) != 0) + { + fputc('\n', stream); + + if(depth > 1) + __config_indent(stream, depth, config->tab_width); + } - if(depth > 1) - __config_indent(stream, depth, tab_width); -#endif fprintf(stream, "{\n"); } @@ -376,11 +381,11 @@ static void __config_write_value(const config_value_t *value, int type, config_setting_t **s; for(s = list->elements; len--; s++) - __config_write_setting(*s, stream, depth + 1, tab_width); + __config_write_setting(config, *s, stream, depth + 1); } if(depth > 1) - __config_indent(stream, depth, tab_width); + __config_indent(stream, depth, config->tab_width); if(depth > 0) fputc('}', stream); @@ -538,9 +543,8 @@ static int __config_validate_name(const char *name) if(*p == '\0') return(CONFIG_FALSE); - if(! isalpha((int)*p) && !isdigit((int)*p) && (*p != '*')) { + if(! isalpha((int)*p) && !isdigit((int)*p) && (*p != '*')) return(CONFIG_FALSE); - } for(++p; *p; ++p) { @@ -559,14 +563,13 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, yyscan_t scanner; struct scan_context scan_ctx; struct parse_context parse_ctx; - /*YY_BUFFER_STATE buffer = NULL;*/ int r; /* Reinitialize the config */ void (*destructor)(void *) = config->destructor; const char *include_dir = config->include_dir; unsigned short tab_width = config->tab_width; - unsigned short flags = config->flags; + int options = config->options; config->include_dir = NULL; config_destroy(config); @@ -575,7 +578,7 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, config->destructor = destructor; config->include_dir = include_dir; config->tab_width = tab_width; - config->flags = flags; + config->options = options; parsectx_init(&parse_ctx); parse_ctx.config = config; @@ -585,13 +588,14 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, __config_locale_override(); scanctx_init(&scan_ctx, filename); + config->root->file = scanctx_current_filename(&scan_ctx); scan_ctx.config = config; libconfig_yylex_init_extra(&scan_ctx, &scanner); if(stream) libconfig_yyrestart(stream, scanner); else /* read from string */ - /*buffer = */libconfig_yy_scan_string(str, scanner); + (void)libconfig_yy_scan_string(str, scanner); libconfig_yyset_lineno(1, scanner); r = libconfig_yyparse(scanner, &parse_ctx, &scan_ctx); @@ -633,26 +637,36 @@ int config_read_string(config_t *config, const char *str) /* ------------------------------------------------------------------------- */ -static void __config_write_setting(const config_setting_t *setting, - FILE *stream, int depth, - unsigned short tab_width) +static void __config_write_setting(const config_t *config, + const config_setting_t *setting, + FILE *stream, int depth) { + char group_assign_char = __config_has_option( + config, CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS) ? ':' : '='; + + char nongroup_assign_char = __config_has_option( + config, CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS) ? ':' : '='; + if(depth > 1) - __config_indent(stream, depth, tab_width); + __config_indent(stream, depth, config->tab_width); + if(setting->name) { fputs(setting->name, stream); - fprintf(stream, " %c ", (setting->type == CONFIG_TYPE_GROUP ? ':' : '=')); + fprintf(stream, " %c ", ((setting->type == CONFIG_TYPE_GROUP) + ? group_assign_char + : nongroup_assign_char)); } - __config_write_value(&(setting->value), setting->type, - config_setting_get_format(setting), - depth, tab_width, stream); + __config_write_value(config, &(setting->value), setting->type, + config_setting_get_format(setting), depth, stream); if(depth > 0) { - fputc(';', stream); + if(__config_has_option(config, CONFIG_OPTION_SEMICOLON_SEPARATORS)) + fputc(';', stream); + fputc('\n', stream); } } @@ -663,7 +677,7 @@ void config_write(const config_t *config, FILE *stream) { __config_locale_override(); - __config_write_setting(config->root, stream, 0, config->tab_width); + __config_write_setting(config, config->root, stream, 0); __config_locale_restore(); } @@ -672,10 +686,28 @@ void config_write(const config_t *config, FILE *stream) int config_read_file(config_t *config, const char *filename) { - int ret; + int ret, ok = 0; + FILE *stream = fopen(filename, "rt"); - if(! stream) + if(stream != NULL) + { + // On some operating systems, fopen() succeeds on a directory. + int fd = fileno(stream); + struct stat statbuf; + + if(fstat(fd, &statbuf) == 0) + { + // Only proceed if this is not a directory. + if(!S_ISDIR(statbuf.st_mode)) + ok = 1; + } + } + + if(!ok) { + if(stream != NULL) + fclose(stream); + config->error_text = __io_error; config->error_type = CONFIG_ERR_FILE_IO; return(CONFIG_FALSE); @@ -691,16 +723,16 @@ int config_read_file(config_t *config, const char *filename) int config_write_file(config_t *config, const char *filename) { - FILE *f = fopen(filename, "wt"); - if(! f) + FILE *stream = fopen(filename, "wt"); + if(stream == NULL) { config->error_text = __io_error; config->error_type = CONFIG_ERR_FILE_IO; return(CONFIG_FALSE); } - config_write(config, f); - fclose(f); + config_write(config, stream); + fclose(stream); config->error_type = CONFIG_ERR_NONE; return(CONFIG_TRUE); } @@ -732,6 +764,9 @@ void config_init(config_t *config) config->root = _new(config_setting_t); config->root->type = CONFIG_TYPE_GROUP; config->root->config = config; + config->options = (CONFIG_OPTION_SEMICOLON_SEPARATORS + | CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS + | CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE); config->tab_width = 2; } @@ -740,16 +775,30 @@ void config_init(config_t *config) void config_set_auto_convert(config_t *config, int flag) { if(flag) - config->flags |= CONFIG_OPTION_AUTOCONVERT; + config->options |= CONFIG_OPTION_AUTOCONVERT; else - config->flags &= ~CONFIG_OPTION_AUTOCONVERT; + config->options &= ~CONFIG_OPTION_AUTOCONVERT; } /* ------------------------------------------------------------------------- */ int config_get_auto_convert(const config_t *config) { - return((config->flags & CONFIG_OPTION_AUTOCONVERT) != 0); + return(__config_has_option(config, CONFIG_OPTION_AUTOCONVERT)); +} + +/* ------------------------------------------------------------------------- */ + +void config_set_options(config_t *config, int options) +{ + config->options = options; +} + +/* ------------------------------------------------------------------------- */ + +int config_get_options(const config_t *config) +{ + return(config->options); } /* ------------------------------------------------------------------------- */ @@ -803,7 +852,7 @@ static int __config_setting_get_int(const config_setting_t *setting, return(CONFIG_TRUE); case CONFIG_TYPE_FLOAT: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { *value = (int)(setting->value.fval); return(CONFIG_TRUE); @@ -841,7 +890,7 @@ static int __config_setting_get_int64(const config_setting_t *setting, return(CONFIG_TRUE); case CONFIG_TYPE_FLOAT: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { *value = (long long)(setting->value.fval); return(CONFIG_TRUE); @@ -1052,7 +1101,7 @@ int config_setting_set_float(config_setting_t *setting, double value) return(CONFIG_TRUE); case CONFIG_TYPE_INT: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { setting->value.ival = (int)value; return(CONFIG_TRUE); @@ -1061,7 +1110,7 @@ int config_setting_set_float(config_setting_t *setting, double value) return(CONFIG_FALSE); case CONFIG_TYPE_INT64: - if((setting->config->flags & CONFIG_OPTION_AUTOCONVERT) != 0) + if(__config_has_option(setting->config, CONFIG_OPTION_AUTOCONVERT)) { setting->value.llval = (long long)value; return(CONFIG_TRUE); @@ -1141,8 +1190,8 @@ short config_setting_get_format(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -config_setting_t *config_lookup_from(config_setting_t *setting, - const char *path) +config_setting_t *config_setting_lookup(config_setting_t *setting, + const char *path) { const char *p = path; config_setting_t *found; @@ -1176,7 +1225,7 @@ config_setting_t *config_lookup_from(config_setting_t *setting, config_setting_t *config_lookup(const config_t *config, const char *path) { - return(config_lookup_from(config->root, path)); + return(config_setting_lookup(config->root, path)); } /* ------------------------------------------------------------------------- */ @@ -1627,4 +1676,3 @@ int config_setting_index(const config_setting_t *setting) } /* ------------------------------------------------------------------------- */ -/* eof */ diff --git a/3rdparty/libconfig/libconfig.h b/3rdparty/libconfig/libconfig.h index cc5c5b79f..cf54775a3 100644 --- a/3rdparty/libconfig/libconfig.h +++ b/3rdparty/libconfig/libconfig.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. @@ -40,8 +40,8 @@ extern "C" { #endif /* WIN32 */ #define LIBCONFIG_VER_MAJOR 1 -#define LIBCONFIG_VER_MINOR 4 -#define LIBCONFIG_VER_REVISION 9 +#define LIBCONFIG_VER_MINOR 5 +#define LIBCONFIG_VER_REVISION 0 #include @@ -58,7 +58,11 @@ extern "C" { #define CONFIG_FORMAT_DEFAULT 0 #define CONFIG_FORMAT_HEX 1 -#define CONFIG_OPTION_AUTOCONVERT 0x01 +#define CONFIG_OPTION_AUTOCONVERT 0x01 +#define CONFIG_OPTION_SEMICOLON_SEPARATORS 0x02 +#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS 0x04 +#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS 0x08 +#define CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE 0x10 #define CONFIG_TRUE (1) #define CONFIG_FALSE (0) @@ -102,7 +106,7 @@ typedef struct config_t { config_setting_t *root; void (*destructor)(void *); - unsigned short flags; + int options; unsigned short tab_width; short default_format; const char *include_dir; @@ -120,6 +124,9 @@ extern LIBCONFIG_API void config_write(const config_t *config, FILE *stream); extern LIBCONFIG_API void config_set_default_format(config_t *config, short format); +extern LIBCONFIG_API void config_set_options(config_t *config, int options); +extern LIBCONFIG_API int config_get_options(const config_t *config); + extern LIBCONFIG_API void config_set_auto_convert(config_t *config, int flag); extern LIBCONFIG_API int config_get_auto_convert(const config_t *config); @@ -260,7 +267,7 @@ extern LIBCONFIG_API void config_setting_set_hook(config_setting_t *setting, extern LIBCONFIG_API config_setting_t *config_lookup(const config_t *config, const char *path); -extern LIBCONFIG_API config_setting_t *config_lookup_from( +extern LIBCONFIG_API config_setting_t *config_setting_lookup( config_setting_t *setting, const char *path); extern LIBCONFIG_API int config_lookup_int(const config_t *config, diff --git a/3rdparty/libconfig/parsectx.h b/3rdparty/libconfig/parsectx.h index 732e5f20d..93cc979c9 100644 --- a/3rdparty/libconfig/parsectx.h +++ b/3rdparty/libconfig/parsectx.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. diff --git a/3rdparty/libconfig/scanctx.c b/3rdparty/libconfig/scanctx.c index f2fe8cd80..b3d9a6379 100644 --- a/3rdparty/libconfig/scanctx.c +++ b/3rdparty/libconfig/scanctx.c @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. @@ -40,7 +40,6 @@ static const char *err_include_too_deep = "include file nesting too deep"; static const char *__scanctx_add_filename(struct scan_context *ctx, const char *filename) { -#ifndef __clang_analyzer__ // FIXME: Clang's static analyzer doesn't like this unsigned int count = ctx->num_filenames; const char **f; @@ -62,7 +61,6 @@ static const char *__scanctx_add_filename(struct scan_context *ctx, ctx->filenames[ctx->num_filenames] = filename; ++ctx->num_filenames; -#endif // __clang_analyzer__ return(filename); } @@ -71,8 +69,10 @@ static const char *__scanctx_add_filename(struct scan_context *ctx, void scanctx_init(struct scan_context *ctx, const char *top_filename) { memset(ctx, 0, sizeof(struct scan_context)); +#ifndef __clang_analyzer__ // FIXME: Clang's static analyzer doesn't like this if(top_filename) ctx->top_filename = __scanctx_add_filename(ctx, strdup(top_filename)); +#endif // __clang_analyzer__ } /* ------------------------------------------------------------------------- */ @@ -124,7 +124,9 @@ FILE *scanctx_push_include(struct scan_context *ctx, void *buffer, if(fp) { ctx->streams[ctx->depth] = fp; +#ifndef __clang_analyzer__ // FIXME: Clang's static analyzer doesn't like this ctx->files[ctx->depth] = __scanctx_add_filename(ctx, file); +#endif // __clang_analyzer__ ctx->buffers[ctx->depth] = buffer; ++(ctx->depth); } @@ -170,4 +172,3 @@ const char *scanctx_current_filename(struct scan_context *ctx) } /* ------------------------------------------------------------------------- */ -/* eof */ diff --git a/3rdparty/libconfig/scanctx.h b/3rdparty/libconfig/scanctx.h index 9bb1f1a0d..c8dc22f87 100644 --- a/3rdparty/libconfig/scanctx.h +++ b/3rdparty/libconfig/scanctx.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. 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 #include #include +#include +#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" diff --git a/3rdparty/libconfig/scanner.h b/3rdparty/libconfig/scanner.h index f684433ec..ce2f5cc95 100644 --- a/3rdparty/libconfig/scanner.h +++ b/3rdparty/libconfig/scanner.h @@ -3,12 +3,8 @@ #define libconfig_yyIN_HEADER 1 #line 6 "scanner.h" -#line 36 "scanner.l" -#include "scanctx.h" - - -#line 12 "scanner.h" +#line 8 "scanner.h" #define YY_INT_ALIGNED short int @@ -16,8 +12,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 @@ -136,7 +132,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 #ifndef YY_TYPEDEF_YY_BUFFER_STATE @@ -216,7 +220,7 @@ void *libconfig_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *libconfig_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); void libconfig_yyfree (void * ,yyscan_t yyscanner ); -#define libconfig_yywrap(yyscanner) 1 +#define libconfig_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -251,11 +255,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 ); @@ -263,11 +267,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 ); @@ -299,7 +303,12 @@ static int yy_flex_strlen (yyconst char * ,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 /* Number of entries by which start-condition stack grows. */ @@ -334,8 +343,8 @@ extern int libconfig_yylex \ #undef YY_DECL #endif -#line 209 "scanner.l" +#line 219 "scanner.l" -#line 340 "scanner.h" +#line 349 "scanner.h" #undef libconfig_yyIN_HEADER #endif /* libconfig_yyHEADER_H */ diff --git a/3rdparty/libconfig/strbuf.c b/3rdparty/libconfig/strbuf.c index 1ed17a899..0b5dfe511 100644 --- a/3rdparty/libconfig/strbuf.c +++ b/3rdparty/libconfig/strbuf.c @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. @@ -55,4 +55,3 @@ void strbuf_append(strbuf_t *buf, const char *text) } /* ------------------------------------------------------------------------- */ -/* eof */ diff --git a/3rdparty/libconfig/strbuf.h b/3rdparty/libconfig/strbuf.h index 8b451e730..948bf4768 100644 --- a/3rdparty/libconfig/strbuf.h +++ b/3rdparty/libconfig/strbuf.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. diff --git a/3rdparty/libconfig/win32/stdint.h b/3rdparty/libconfig/win32/stdint.h new file mode 100644 index 000000000..71c0776d0 --- /dev/null +++ b/3rdparty/libconfig/win32/stdint.h @@ -0,0 +1,221 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#if (_MSC_VER < 1300) && defined(__cplusplus) + extern "C++" { +#endif +# include +#if (_MSC_VER < 1300) && defined(__cplusplus) + } +#endif + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef int intptr_t; + typedef unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + +#endif // _MSC_STDINT_H_ ] diff --git a/3rdparty/libconfig/wincompat.h b/3rdparty/libconfig/wincompat.h index 418191972..7e30f0e8d 100644 --- a/3rdparty/libconfig/wincompat.h +++ b/3rdparty/libconfig/wincompat.h @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files - Copyright (C) 2013-2015 Hercules Dev Team - 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. @@ -32,12 +32,19 @@ #define WIN32_LEAN_AND_MEAN #include +#define fileno _fileno +#define fstat _fstat +#define stat _stat // struct stat for fstat() #define snprintf _snprintf -#ifndef __MINGW32__ +#if !defined(__MINGW32__) && _MSC_VER < 1800 #define atoll _atoi64 #define strtoull _strtoui64 -#endif /* __MINGW32__ */ +#endif + +#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif #endif -- cgit v1.2.3-70-g09d2 From 6c127b3ec4f73f02aff5b37e9526dcc249d95c54 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 15 Feb 2016 17:33:54 +0100 Subject: libconfig: report file name in case of i/o error Signed-off-by: Haru --- 3rdparty/libconfig/libconfig.c | 1 + 1 file changed, 1 insertion(+) (limited to '3rdparty/libconfig') diff --git a/3rdparty/libconfig/libconfig.c b/3rdparty/libconfig/libconfig.c index afc65dfef..72520e7c5 100644 --- a/3rdparty/libconfig/libconfig.c +++ b/3rdparty/libconfig/libconfig.c @@ -728,6 +728,7 @@ int config_write_file(config_t *config, const char *filename) { config->error_text = __io_error; config->error_type = CONFIG_ERR_FILE_IO; + config->error_file = filename; return(CONFIG_FALSE); } -- cgit v1.2.3-70-g09d2 From 03a5c603be2cf6d5feea9012029f8899c624557a Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 16 Feb 2016 18:07:52 +0100 Subject: Removed unnecessary typedefs from libconfig Signed-off-by: Haru --- 3rdparty/libconfig/extra/gen/grammar.y | 18 +-- 3rdparty/libconfig/grammar.c | 18 +-- 3rdparty/libconfig/libconfig.c | 242 ++++++++++++++++----------------- 3rdparty/libconfig/libconfig.h | 210 ++++++++++++++-------------- 3rdparty/libconfig/parsectx.h | 6 +- 3rdparty/libconfig/scanctx.h | 2 +- src/common/HPM.c | 6 +- src/common/conf.c | 55 ++++---- src/common/conf.h | 164 +++++++++++----------- src/common/showmsg.c | 4 +- src/common/showmsg.h | 2 +- src/common/socket.c | 4 +- src/common/socket.h | 2 +- src/map/atcommand.c | 18 +-- src/map/atcommand.h | 2 +- src/map/battleground.c | 12 +- src/map/channel.c | 14 +- src/map/clif.c | 16 +-- src/map/itemdb.c | 30 ++-- src/map/itemdb.h | 6 +- src/map/map.c | 44 +++--- src/map/mob.c | 30 ++-- src/map/mob.h | 16 +-- src/map/pc.c | 10 +- src/map/pc_groups.c | 24 ++-- src/map/pc_groups.h | 8 +- src/map/quest.c | 12 +- src/map/quest.h | 2 +- src/map/script.c | 10 +- src/map/status.c | 24 ++-- src/map/status.h | 4 +- src/plugins/db2sql.c | 10 +- src/test/test_libconfig.c | 86 ++++++------ 33 files changed, 557 insertions(+), 554 deletions(-) (limited to '3rdparty/libconfig') diff --git a/3rdparty/libconfig/extra/gen/grammar.y b/3rdparty/libconfig/extra/gen/grammar.y index 2e4cfa45f..ef8ed4f18 100644 --- a/3rdparty/libconfig/extra/gen/grammar.y +++ b/3rdparty/libconfig/extra/gen/grammar.y @@ -63,7 +63,7 @@ static const char *err_duplicate_setting = "duplicate setting name"; (ctx->parent && (ctx->parent->type == CONFIG_TYPE_LIST)) static void capture_parse_pos(void *scanner, struct scan_context *scan_ctx, - config_setting_t *setting) + struct config_setting_t *setting) { setting->line = (unsigned int)libconfig_yyget_lineno(scanner); setting->file = scanctx_current_filename(scan_ctx); @@ -206,8 +206,8 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, - (int)$1); + struct config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, + (int)$1); if(! e) { @@ -226,7 +226,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -248,7 +248,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -270,7 +270,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -292,7 +292,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -314,7 +314,7 @@ simple_value: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, $1); + struct config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, $1); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -333,7 +333,7 @@ simple_value: if(IN_ARRAY() || IN_LIST()) { const char *s = parsectx_take_string(ctx); - config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); + struct config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); _delete(s); if(! e) diff --git a/3rdparty/libconfig/grammar.c b/3rdparty/libconfig/grammar.c index ee1da702e..7d5757b2f 100644 --- a/3rdparty/libconfig/grammar.c +++ b/3rdparty/libconfig/grammar.c @@ -104,7 +104,7 @@ static const char *err_duplicate_setting = "duplicate setting name"; (ctx->parent && (ctx->parent->type == CONFIG_TYPE_LIST)) static void capture_parse_pos(void *scanner, struct scan_context *scan_ctx, - config_setting_t *setting) + struct config_setting_t *setting) { setting->line = (unsigned int)libconfig_yyget_lineno(scanner); setting->file = scanctx_current_filename(scan_ctx); @@ -1601,8 +1601,8 @@ yyreduce: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, - (int)(yyvsp[(1) - (1)].ival)); + struct config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1, + (int)(yyvsp[(1) - (1)].ival)); if(! e) { @@ -1625,7 +1625,7 @@ yyreduce: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival)); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1651,7 +1651,7 @@ yyreduce: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval)); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1677,7 +1677,7 @@ yyreduce: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival)); + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1703,7 +1703,7 @@ yyreduce: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval)); + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1729,7 +1729,7 @@ yyreduce: { if(IN_ARRAY() || IN_LIST()) { - config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, (yyvsp[(1) - (1)].fval)); + struct config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, (yyvsp[(1) - (1)].fval)); if(! e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); @@ -1752,7 +1752,7 @@ yyreduce: if(IN_ARRAY() || IN_LIST()) { const char *s = parsectx_take_string(ctx); - config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); + struct config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s); _delete(s); if(! e) diff --git a/3rdparty/libconfig/libconfig.c b/3rdparty/libconfig/libconfig.c index 72520e7c5..0942241c2 100644 --- a/3rdparty/libconfig/libconfig.c +++ b/3rdparty/libconfig/libconfig.c @@ -70,9 +70,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) static const char *__io_error = "file I/O error"; -static void __config_list_destroy(config_list_t *list); -static void __config_write_setting(const config_t *config, - const config_setting_t *setting, +static void __config_list_destroy(struct config_list_t *list); +static void __config_write_setting(const struct config_t *config, + const struct config_setting_t *setting, FILE *stream, int depth); /* ------------------------------------------------------------------------- */ @@ -174,8 +174,8 @@ static void __config_indent(FILE *stream, int depth, unsigned short w) /* ------------------------------------------------------------------------- */ -static void __config_write_value(const config_t *config, - const config_value_t *value, int type, +static void __config_write_value(const struct config_t *config, + const union config_value_t *value, int type, int format, int depth, FILE *stream) { char fbuf[64]; @@ -302,14 +302,14 @@ static void __config_write_value(const config_t *config, /* list */ case CONFIG_TYPE_LIST: { - config_list_t *list = value->list; + struct config_list_t *list = value->list; fprintf(stream, "( "); if(list) { int len = list->length; - config_setting_t **s; + struct config_setting_t **s; for(s = list->elements; len--; s++) { @@ -331,14 +331,14 @@ static void __config_write_value(const config_t *config, /* array */ case CONFIG_TYPE_ARRAY: { - config_list_t *list = value->list; + struct config_list_t *list = value->list; fprintf(stream, "[ "); if(list) { int len = list->length; - config_setting_t **s; + struct config_setting_t **s; for(s = list->elements; len--; s++) { @@ -360,7 +360,7 @@ static void __config_write_value(const config_t *config, /* group */ case CONFIG_TYPE_GROUP: { - config_list_t *list = value->list; + struct config_list_t *list = value->list; if(depth > 0) { @@ -378,7 +378,7 @@ static void __config_write_value(const config_t *config, if(list) { int len = list->length; - config_setting_t **s; + struct config_setting_t **s; for(s = list->elements; len--; s++) __config_write_setting(config, *s, stream, depth + 1); @@ -402,13 +402,13 @@ static void __config_write_value(const config_t *config, /* ------------------------------------------------------------------------- */ -static void __config_list_add(config_list_t *list, config_setting_t *setting) +static void __config_list_add(struct config_list_t *list, struct config_setting_t *setting) { if((list->length % CHUNK_SIZE) == 0) { - list->elements = (config_setting_t **)realloc( + list->elements = (struct config_setting_t **)realloc( list->elements, - (list->length + CHUNK_SIZE) * sizeof(config_setting_t *)); + (list->length + CHUNK_SIZE) * sizeof(struct config_setting_t *)); } list->elements[list->length] = setting; @@ -417,11 +417,11 @@ static void __config_list_add(config_list_t *list, config_setting_t *setting) /* ------------------------------------------------------------------------- */ -static config_setting_t *__config_list_search(config_list_t *list, +static struct config_setting_t *__config_list_search(struct config_list_t *list, const char *name, unsigned int *idx) { - config_setting_t **found = NULL; + struct config_setting_t **found = NULL; unsigned int i; if(! list) @@ -446,15 +446,15 @@ static config_setting_t *__config_list_search(config_list_t *list, /* ------------------------------------------------------------------------- */ -static config_setting_t *__config_list_remove(config_list_t *list, int idx) +static struct config_setting_t *__config_list_remove(struct config_list_t *list, int idx) { - config_setting_t *removed = *(list->elements + idx); - int offset = (idx * sizeof(config_setting_t *)); + struct config_setting_t *removed = *(list->elements + idx); + int offset = (idx * sizeof(struct config_setting_t *)); int len = list->length - 1 - idx; char *base = (char *)list->elements + offset; - memmove(base, base + sizeof(config_setting_t *), - len * sizeof(config_setting_t *)); + memmove(base, base + sizeof(struct config_setting_t *), + len * sizeof(struct config_setting_t *)); list->length--; @@ -465,7 +465,7 @@ static config_setting_t *__config_list_remove(config_list_t *list, int idx) /* ------------------------------------------------------------------------- */ -static void __config_setting_destroy(config_setting_t *setting) +static void __config_setting_destroy(struct config_setting_t *setting) { if(setting) { @@ -492,9 +492,9 @@ static void __config_setting_destroy(config_setting_t *setting) /* ------------------------------------------------------------------------- */ -static void __config_list_destroy(config_list_t *list) +static void __config_list_destroy(struct config_list_t *list) { - config_setting_t **p; + struct config_setting_t **p; unsigned int i; if(! list) @@ -513,7 +513,7 @@ static void __config_list_destroy(config_list_t *list) /* ------------------------------------------------------------------------- */ -static int __config_vector_checktype(const config_setting_t *vector, int type) +static int __config_vector_checktype(const struct config_setting_t *vector, int type) { /* if the array is empty, then it has no type yet */ @@ -557,7 +557,7 @@ static int __config_validate_name(const char *name) /* ------------------------------------------------------------------------- */ -static int __config_read(config_t *config, FILE *stream, const char *filename, +static int __config_read(struct config_t *config, FILE *stream, const char *filename, const char *str) { yyscan_t scanner; @@ -623,22 +623,22 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, /* ------------------------------------------------------------------------- */ -int config_read(config_t *config, FILE *stream) +int config_read(struct config_t *config, FILE *stream) { return(__config_read(config, stream, NULL, NULL)); } /* ------------------------------------------------------------------------- */ -int config_read_string(config_t *config, const char *str) +int config_read_string(struct config_t *config, const char *str) { return(__config_read(config, NULL, NULL, str)); } /* ------------------------------------------------------------------------- */ -static void __config_write_setting(const config_t *config, - const config_setting_t *setting, +static void __config_write_setting(const struct config_t *config, + const struct config_setting_t *setting, FILE *stream, int depth) { char group_assign_char = __config_has_option( @@ -673,7 +673,7 @@ static void __config_write_setting(const config_t *config, /* ------------------------------------------------------------------------- */ -void config_write(const config_t *config, FILE *stream) +void config_write(const struct config_t *config, FILE *stream) { __config_locale_override(); @@ -684,7 +684,7 @@ void config_write(const config_t *config, FILE *stream) /* ------------------------------------------------------------------------- */ -int config_read_file(config_t *config, const char *filename) +int config_read_file(struct config_t *config, const char *filename) { int ret, ok = 0; @@ -721,7 +721,7 @@ int config_read_file(config_t *config, const char *filename) /* ------------------------------------------------------------------------- */ -int config_write_file(config_t *config, const char *filename) +int config_write_file(struct config_t *config, const char *filename) { FILE *stream = fopen(filename, "wt"); if(stream == NULL) @@ -740,7 +740,7 @@ int config_write_file(config_t *config, const char *filename) /* ------------------------------------------------------------------------- */ -void config_destroy(config_t *config) +void config_destroy(struct config_t *config) { unsigned int count = config->num_filenames; const char **f; @@ -753,16 +753,16 @@ void config_destroy(config_t *config) _delete(config->filenames); _delete(config->include_dir); - memset((void *)config, 0, sizeof(config_t)); + memset((void *)config, 0, sizeof(struct config_t)); } /* ------------------------------------------------------------------------- */ -void config_init(config_t *config) +void config_init(struct config_t *config) { - memset((void *)config, 0, sizeof(config_t)); + memset((void *)config, 0, sizeof(struct config_t)); - config->root = _new(config_setting_t); + config->root = _new(struct config_setting_t); config->root->type = CONFIG_TYPE_GROUP; config->root->config = config; config->options = (CONFIG_OPTION_SEMICOLON_SEPARATORS @@ -773,7 +773,7 @@ void config_init(config_t *config) /* ------------------------------------------------------------------------- */ -void config_set_auto_convert(config_t *config, int flag) +void config_set_auto_convert(struct config_t *config, int flag) { if(flag) config->options |= CONFIG_OPTION_AUTOCONVERT; @@ -783,39 +783,39 @@ void config_set_auto_convert(config_t *config, int flag) /* ------------------------------------------------------------------------- */ -int config_get_auto_convert(const config_t *config) +int config_get_auto_convert(const struct config_t *config) { return(__config_has_option(config, CONFIG_OPTION_AUTOCONVERT)); } /* ------------------------------------------------------------------------- */ -void config_set_options(config_t *config, int options) +void config_set_options(struct config_t *config, int options) { config->options = options; } /* ------------------------------------------------------------------------- */ -int config_get_options(const config_t *config) +int config_get_options(const struct config_t *config) { return(config->options); } /* ------------------------------------------------------------------------- */ -static config_setting_t *config_setting_create(config_setting_t *parent, +static struct config_setting_t *config_setting_create(struct config_setting_t *parent, const char *name, int type) { - config_setting_t *setting; - config_list_t *list; + struct config_setting_t *setting; + struct config_list_t *list; if((parent->type != CONFIG_TYPE_GROUP) && (parent->type != CONFIG_TYPE_ARRAY) && (parent->type != CONFIG_TYPE_LIST)) return(NULL); - setting = _new(config_setting_t); + setting = _new(struct config_setting_t); setting->parent = parent; setting->name = (name == NULL) ? NULL : strdup(name); setting->type = type; @@ -826,7 +826,7 @@ static config_setting_t *config_setting_create(config_setting_t *parent, list = parent->value.list; if(! list) - list = parent->value.list = _new(config_list_t); + list = parent->value.list = _new(struct config_list_t); __config_list_add(list, setting); @@ -835,7 +835,7 @@ static config_setting_t *config_setting_create(config_setting_t *parent, /* ------------------------------------------------------------------------- */ -static int __config_setting_get_int(const config_setting_t *setting, +static int __config_setting_get_int(const struct config_setting_t *setting, int *value) { switch(setting->type) @@ -868,7 +868,7 @@ static int __config_setting_get_int(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_get_int(const config_setting_t *setting) +int config_setting_get_int(const struct config_setting_t *setting) { int value = 0; __config_setting_get_int(setting, &value); @@ -877,7 +877,7 @@ int config_setting_get_int(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -static int __config_setting_get_int64(const config_setting_t *setting, +static int __config_setting_get_int64(const struct config_setting_t *setting, long long *value) { switch(setting->type) @@ -906,7 +906,7 @@ static int __config_setting_get_int64(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -long long config_setting_get_int64(const config_setting_t *setting) +long long config_setting_get_int64(const struct config_setting_t *setting) { long long value = 0; __config_setting_get_int64(setting, &value); @@ -915,10 +915,10 @@ long long config_setting_get_int64(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -int config_setting_lookup_int(const config_setting_t *setting, +int config_setting_lookup_int(const struct config_setting_t *setting, const char *name, int *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -927,10 +927,10 @@ int config_setting_lookup_int(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_lookup_int64(const config_setting_t *setting, +int config_setting_lookup_int64(const struct config_setting_t *setting, const char *name, long long *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -939,7 +939,7 @@ int config_setting_lookup_int64(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -static int __config_setting_get_float(const config_setting_t *setting, +static int __config_setting_get_float(const struct config_setting_t *setting, double *value) { switch(setting->type) @@ -973,7 +973,7 @@ static int __config_setting_get_float(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -double config_setting_get_float(const config_setting_t *setting) +double config_setting_get_float(const struct config_setting_t *setting) { double value = 0.0; __config_setting_get_float(setting, &value); @@ -982,10 +982,10 @@ double config_setting_get_float(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -int config_setting_lookup_float(const config_setting_t *setting, +int config_setting_lookup_float(const struct config_setting_t *setting, const char *name, double *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -994,10 +994,10 @@ int config_setting_lookup_float(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_lookup_string(const config_setting_t *setting, +int config_setting_lookup_string(const struct config_setting_t *setting, const char *name, const char **value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -1010,10 +1010,10 @@ int config_setting_lookup_string(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_lookup_bool(const config_setting_t *setting, +int config_setting_lookup_bool(const struct config_setting_t *setting, const char *name, int *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if(! member) return(CONFIG_FALSE); @@ -1026,7 +1026,7 @@ int config_setting_lookup_bool(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -int config_setting_set_int(config_setting_t *setting, int value) +int config_setting_set_int(struct config_setting_t *setting, int value) { switch(setting->type) { @@ -1054,7 +1054,7 @@ int config_setting_set_int(config_setting_t *setting, int value) /* ------------------------------------------------------------------------- */ -int config_setting_set_int64(config_setting_t *setting, long long value) +int config_setting_set_int64(struct config_setting_t *setting, long long value) { switch(setting->type) { @@ -1089,7 +1089,7 @@ int config_setting_set_int64(config_setting_t *setting, long long value) /* ------------------------------------------------------------------------- */ -int config_setting_set_float(config_setting_t *setting, double value) +int config_setting_set_float(struct config_setting_t *setting, double value) { switch(setting->type) { @@ -1126,14 +1126,14 @@ int config_setting_set_float(config_setting_t *setting, double value) /* ------------------------------------------------------------------------- */ -int config_setting_get_bool(const config_setting_t *setting) +int config_setting_get_bool(const struct config_setting_t *setting) { return((setting->type == CONFIG_TYPE_BOOL) ? setting->value.ival : 0); } /* ------------------------------------------------------------------------- */ -int config_setting_set_bool(config_setting_t *setting, int value) +int config_setting_set_bool(struct config_setting_t *setting, int value) { if(setting->type == CONFIG_TYPE_NONE) setting->type = CONFIG_TYPE_BOOL; @@ -1146,14 +1146,14 @@ int config_setting_set_bool(config_setting_t *setting, int value) /* ------------------------------------------------------------------------- */ -const char *config_setting_get_string(const config_setting_t *setting) +const char *config_setting_get_string(const struct config_setting_t *setting) { return((setting->type == CONFIG_TYPE_STRING) ? setting->value.sval : NULL); } /* ------------------------------------------------------------------------- */ -int config_setting_set_string(config_setting_t *setting, const char *value) +int config_setting_set_string(struct config_setting_t *setting, const char *value) { if(setting->type == CONFIG_TYPE_NONE) setting->type = CONFIG_TYPE_STRING; @@ -1169,7 +1169,7 @@ int config_setting_set_string(config_setting_t *setting, const char *value) /* ------------------------------------------------------------------------- */ -int config_setting_set_format(config_setting_t *setting, short format) +int config_setting_set_format(struct config_setting_t *setting, short format) { if(((setting->type != CONFIG_TYPE_INT) && (setting->type != CONFIG_TYPE_INT64)) @@ -1183,7 +1183,7 @@ int config_setting_set_format(config_setting_t *setting, short format) /* ------------------------------------------------------------------------- */ -short config_setting_get_format(const config_setting_t *setting) +short config_setting_get_format(const struct config_setting_t *setting) { return(setting->format != 0 ? setting->format : setting->config->default_format); @@ -1191,11 +1191,11 @@ short config_setting_get_format(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_lookup(config_setting_t *setting, +struct config_setting_t *config_setting_lookup(struct config_setting_t *setting, const char *path) { const char *p = path; - config_setting_t *found; + struct config_setting_t *found; for(;;) { @@ -1224,17 +1224,17 @@ config_setting_t *config_setting_lookup(config_setting_t *setting, /* ------------------------------------------------------------------------- */ -config_setting_t *config_lookup(const config_t *config, const char *path) +struct config_setting_t *config_lookup(const struct config_t *config, const char *path) { return(config_setting_lookup(config->root, path)); } /* ------------------------------------------------------------------------- */ -int config_lookup_string(const config_t *config, const char *path, +int config_lookup_string(const struct config_t *config, const char *path, const char **value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1248,10 +1248,10 @@ int config_lookup_string(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_int(const config_t *config, const char *path, +int config_lookup_int(const struct config_t *config, const char *path, int *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1260,10 +1260,10 @@ int config_lookup_int(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_int64(const config_t *config, const char *path, +int config_lookup_int64(const struct config_t *config, const char *path, long long *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1272,10 +1272,10 @@ int config_lookup_int64(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_float(const config_t *config, const char *path, +int config_lookup_float(const struct config_t *config, const char *path, double *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1284,9 +1284,9 @@ int config_lookup_float(const config_t *config, const char *path, /* ------------------------------------------------------------------------- */ -int config_lookup_bool(const config_t *config, const char *path, int *value) +int config_lookup_bool(const struct config_t *config, const char *path, int *value) { - const config_setting_t *s = config_lookup(config, path); + const struct config_setting_t *s = config_lookup(config, path); if(! s) return(CONFIG_FALSE); @@ -1299,19 +1299,19 @@ int config_lookup_bool(const config_t *config, const char *path, int *value) /* ------------------------------------------------------------------------- */ -int config_setting_get_int_elem(const config_setting_t *vector, int idx) +int config_setting_get_int_elem(const struct config_setting_t *vector, int idx) { - const config_setting_t *element = config_setting_get_elem(vector, idx); + const struct config_setting_t *element = config_setting_get_elem(vector, idx); return(element ? config_setting_get_int(element) : 0); } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_int_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_int_elem(struct config_setting_t *vector, int idx, int value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1339,20 +1339,20 @@ config_setting_t *config_setting_set_int_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -long long config_setting_get_int64_elem(const config_setting_t *vector, +long long config_setting_get_int64_elem(const struct config_setting_t *vector, int idx) { - const config_setting_t *element = config_setting_get_elem(vector, idx); + const struct config_setting_t *element = config_setting_get_elem(vector, idx); return(element ? config_setting_get_int64(element) : 0); } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_int64_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_int64_elem(struct config_setting_t *vector, int idx, long long value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1380,19 +1380,19 @@ config_setting_t *config_setting_set_int64_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -double config_setting_get_float_elem(const config_setting_t *vector, int idx) +double config_setting_get_float_elem(const struct config_setting_t *vector, int idx) { - config_setting_t *element = config_setting_get_elem(vector, idx); + struct config_setting_t *element = config_setting_get_elem(vector, idx); return(element ? config_setting_get_float(element) : 0.0); } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_float_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_float_elem(struct config_setting_t *vector, int idx, double value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1418,9 +1418,9 @@ config_setting_t *config_setting_set_float_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -int config_setting_get_bool_elem(const config_setting_t *vector, int idx) +int config_setting_get_bool_elem(const struct config_setting_t *vector, int idx) { - config_setting_t *element = config_setting_get_elem(vector, idx); + struct config_setting_t *element = config_setting_get_elem(vector, idx); if(! element) return(CONFIG_FALSE); @@ -1433,10 +1433,10 @@ int config_setting_get_bool_elem(const config_setting_t *vector, int idx) /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_bool_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_bool_elem(struct config_setting_t *vector, int idx, int value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1462,10 +1462,10 @@ config_setting_t *config_setting_set_bool_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -const char *config_setting_get_string_elem(const config_setting_t *vector, +const char *config_setting_get_string_elem(const struct config_setting_t *vector, int idx) { - config_setting_t *element = config_setting_get_elem(vector, idx); + struct config_setting_t *element = config_setting_get_elem(vector, idx); if(! element) return(NULL); @@ -1478,10 +1478,10 @@ const char *config_setting_get_string_elem(const config_setting_t *vector, /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_set_string_elem(config_setting_t *vector, +struct config_setting_t *config_setting_set_string_elem(struct config_setting_t *vector, int idx, const char *value) { - config_setting_t *element = NULL; + struct config_setting_t *element = NULL; if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST)) return(NULL); @@ -1507,10 +1507,10 @@ config_setting_t *config_setting_set_string_elem(config_setting_t *vector, /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_get_elem(const config_setting_t *vector, +struct config_setting_t *config_setting_get_elem(const struct config_setting_t *vector, unsigned int idx) { - config_list_t *list = vector->value.list; + struct config_list_t *list = vector->value.list; if(((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST) @@ -1525,7 +1525,7 @@ config_setting_t *config_setting_get_elem(const config_setting_t *vector, /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_get_member(const config_setting_t *setting, +struct config_setting_t *config_setting_get_member(const struct config_setting_t *setting, const char *name) { if(setting->type != CONFIG_TYPE_GROUP) @@ -1536,14 +1536,14 @@ config_setting_t *config_setting_get_member(const config_setting_t *setting, /* ------------------------------------------------------------------------- */ -void config_set_destructor(config_t *config, void (*destructor)(void *)) +void config_set_destructor(struct config_t *config, void (*destructor)(void *)) { config->destructor = destructor; } /* ------------------------------------------------------------------------- */ -void config_set_include_dir(config_t *config, const char *include_dir) +void config_set_include_dir(struct config_t *config, const char *include_dir) { _delete(config->include_dir); config->include_dir = strdup(include_dir); @@ -1551,7 +1551,7 @@ void config_set_include_dir(config_t *config, const char *include_dir) /* ------------------------------------------------------------------------- */ -int config_setting_length(const config_setting_t *setting) +int config_setting_length(const struct config_setting_t *setting) { if((setting->type != CONFIG_TYPE_GROUP) && (setting->type != CONFIG_TYPE_ARRAY) @@ -1566,14 +1566,14 @@ int config_setting_length(const config_setting_t *setting) /* ------------------------------------------------------------------------- */ -void config_setting_set_hook(config_setting_t *setting, void *hook) +void config_setting_set_hook(struct config_setting_t *setting, void *hook) { setting->hook = hook; } /* ------------------------------------------------------------------------- */ -config_setting_t *config_setting_add(config_setting_t *parent, +struct config_setting_t *config_setting_add(struct config_setting_t *parent, const char *name, int type) { if((type < CONFIG_TYPE_NONE) || (type > CONFIG_TYPE_LIST)) @@ -1608,10 +1608,10 @@ config_setting_t *config_setting_add(config_setting_t *parent, /* ------------------------------------------------------------------------- */ -int config_setting_remove(config_setting_t *parent, const char *name) +int config_setting_remove(struct config_setting_t *parent, const char *name) { unsigned int idx; - config_setting_t *setting; + struct config_setting_t *setting; if(! parent) return(CONFIG_FALSE); @@ -1630,10 +1630,10 @@ int config_setting_remove(config_setting_t *parent, const char *name) /* ------------------------------------------------------------------------- */ -int config_setting_remove_elem(config_setting_t *parent, unsigned int idx) +int config_setting_remove_elem(struct config_setting_t *parent, unsigned int idx) { - config_list_t *list; - config_setting_t *removed = NULL; + struct config_list_t *list; + struct config_setting_t *removed = NULL; if(! parent) return(CONFIG_FALSE); @@ -1656,10 +1656,10 @@ int config_setting_remove_elem(config_setting_t *parent, unsigned int idx) /* ------------------------------------------------------------------------- */ -int config_setting_index(const config_setting_t *setting) +int config_setting_index(const struct config_setting_t *setting) { - config_setting_t **found = NULL; - config_list_t *list; + struct config_setting_t **found = NULL; + struct config_list_t *list; int i; if(! setting->parent) diff --git a/3rdparty/libconfig/libconfig.h b/3rdparty/libconfig/libconfig.h index cf54775a3..58c1f914e 100644 --- a/3rdparty/libconfig/libconfig.h +++ b/3rdparty/libconfig/libconfig.h @@ -67,44 +67,44 @@ extern "C" { #define CONFIG_TRUE (1) #define CONFIG_FALSE (0) -typedef union config_value_t +union config_value_t { int ival; long long llval; double fval; char *sval; struct config_list_t *list; -} config_value_t; +}; -typedef struct config_setting_t +struct config_setting_t { char *name; short type; short format; - config_value_t value; + union config_value_t value; struct config_setting_t *parent; struct config_t *config; void *hook; unsigned int line; const char *file; -} config_setting_t; +}; -typedef enum +enum config_error_t { CONFIG_ERR_NONE = 0, CONFIG_ERR_FILE_IO = 1, CONFIG_ERR_PARSE = 2 -} config_error_t; +}; -typedef struct config_list_t +struct config_list_t { unsigned int length; - config_setting_t **elements; -} config_list_t; + struct config_setting_t **elements; +}; -typedef struct config_t +struct config_t { - config_setting_t *root; + struct config_setting_t *root; void (*destructor)(void *); int options; unsigned short tab_width; @@ -113,212 +113,212 @@ typedef struct config_t const char *error_text; const char *error_file; int error_line; - config_error_t error_type; + enum config_error_t error_type; const char **filenames; unsigned int num_filenames; -} config_t; +}; -extern LIBCONFIG_API int config_read(config_t *config, FILE *stream); -extern LIBCONFIG_API void config_write(const config_t *config, FILE *stream); +extern LIBCONFIG_API int config_read(struct config_t *config, FILE *stream); +extern LIBCONFIG_API void config_write(const struct config_t *config, FILE *stream); -extern LIBCONFIG_API void config_set_default_format(config_t *config, +extern LIBCONFIG_API void config_set_default_format(struct config_t *config, short format); -extern LIBCONFIG_API void config_set_options(config_t *config, int options); -extern LIBCONFIG_API int config_get_options(const config_t *config); +extern LIBCONFIG_API void config_set_options(struct config_t *config, int options); +extern LIBCONFIG_API int config_get_options(const struct config_t *config); -extern LIBCONFIG_API void config_set_auto_convert(config_t *config, int flag); -extern LIBCONFIG_API int config_get_auto_convert(const config_t *config); +extern LIBCONFIG_API void config_set_auto_convert(struct config_t *config, int flag); +extern LIBCONFIG_API int config_get_auto_convert(const struct config_t *config); -extern LIBCONFIG_API int config_read_string(config_t *config, const char *str); +extern LIBCONFIG_API int config_read_string(struct config_t *config, const char *str); -extern LIBCONFIG_API int config_read_file(config_t *config, +extern LIBCONFIG_API int config_read_file(struct config_t *config, const char *filename); -extern LIBCONFIG_API int config_write_file(config_t *config, +extern LIBCONFIG_API int config_write_file(struct config_t *config, const char *filename); -extern LIBCONFIG_API void config_set_destructor(config_t *config, +extern LIBCONFIG_API void config_set_destructor(struct config_t *config, void (*destructor)(void *)); -extern LIBCONFIG_API void config_set_include_dir(config_t *config, +extern LIBCONFIG_API void config_set_include_dir(struct config_t *config, const char *include_dir); -extern LIBCONFIG_API void config_init(config_t *config); -extern LIBCONFIG_API void config_destroy(config_t *config); +extern LIBCONFIG_API void config_init(struct config_t *config); +extern LIBCONFIG_API void config_destroy(struct config_t *config); extern LIBCONFIG_API int config_setting_get_int( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API long long config_setting_get_int64( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API double config_setting_get_float( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_get_bool( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API const char *config_setting_get_string( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_lookup_int( - const config_setting_t *setting, const char *name, int *value); + const struct config_setting_t *setting, const char *name, int *value); extern LIBCONFIG_API int config_setting_lookup_int64( - const config_setting_t *setting, const char *name, long long *value); + const struct config_setting_t *setting, const char *name, long long *value); extern LIBCONFIG_API int config_setting_lookup_float( - const config_setting_t *setting, const char *name, double *value); + const struct config_setting_t *setting, const char *name, double *value); extern LIBCONFIG_API int config_setting_lookup_bool( - const config_setting_t *setting, const char *name, int *value); + const struct config_setting_t *setting, const char *name, int *value); extern LIBCONFIG_API int config_setting_lookup_string( - const config_setting_t *setting, const char *name, const char **value); + const struct config_setting_t *setting, const char *name, const char **value); -extern LIBCONFIG_API int config_setting_set_int(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_int(struct config_setting_t *setting, int value); -extern LIBCONFIG_API int config_setting_set_int64(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_int64(struct config_setting_t *setting, long long value); -extern LIBCONFIG_API int config_setting_set_float(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_float(struct config_setting_t *setting, double value); -extern LIBCONFIG_API int config_setting_set_bool(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_bool(struct config_setting_t *setting, int value); -extern LIBCONFIG_API int config_setting_set_string(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_string(struct config_setting_t *setting, const char *value); -extern LIBCONFIG_API int config_setting_set_format(config_setting_t *setting, +extern LIBCONFIG_API int config_setting_set_format(struct config_setting_t *setting, short format); extern LIBCONFIG_API short config_setting_get_format( - const config_setting_t *setting); + const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_get_int_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API long long config_setting_get_int64_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API double config_setting_get_float_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API int config_setting_get_bool_elem( - const config_setting_t *setting, int idx); + const struct config_setting_t *setting, int idx); extern LIBCONFIG_API const char *config_setting_get_string_elem( - const config_setting_t *setting, int idx); - -extern LIBCONFIG_API config_setting_t *config_setting_set_int_elem( - config_setting_t *setting, int idx, int value); -extern LIBCONFIG_API config_setting_t *config_setting_set_int64_elem( - config_setting_t *setting, int idx, long long value); -extern LIBCONFIG_API config_setting_t *config_setting_set_float_elem( - config_setting_t *setting, int idx, double value); -extern LIBCONFIG_API config_setting_t *config_setting_set_bool_elem( - config_setting_t *setting, int idx, int value); -extern LIBCONFIG_API config_setting_t *config_setting_set_string_elem( - config_setting_t *setting, int idx, const char *value); - -#define /* const char * */ config_get_include_dir(/* const config_t * */ C) \ + const struct config_setting_t *setting, int idx); + +extern LIBCONFIG_API struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern LIBCONFIG_API struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); + +#define /* const char * */ config_get_include_dir(/* const struct config_t * */ C) \ ((C)->include_dir) -#define /* int */ config_setting_type(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_type(/* const struct config_setting_t * */ S) \ ((S)->type) -#define /* int */ config_setting_is_group(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_group(/* const struct config_setting_t * */ S) \ ((S)->type == CONFIG_TYPE_GROUP) -#define /* int */ config_setting_is_array(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_array(/* const struct config_setting_t * */ S) \ ((S)->type == CONFIG_TYPE_ARRAY) -#define /* int */ config_setting_is_list(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_list(/* const struct config_setting_t * */ S) \ ((S)->type == CONFIG_TYPE_LIST) #define /* int */ config_setting_is_aggregate( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ (((S)->type == CONFIG_TYPE_GROUP) || ((S)->type == CONFIG_TYPE_LIST) \ || ((S)->type == CONFIG_TYPE_ARRAY)) -#define /* int */ config_setting_is_number(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_number(/* const struct config_setting_t * */ S) \ (((S)->type == CONFIG_TYPE_INT) \ || ((S)->type == CONFIG_TYPE_INT64) \ || ((S)->type == CONFIG_TYPE_FLOAT)) -#define /* int */ config_setting_is_scalar(/* const config_setting_t * */ S) \ +#define /* int */ config_setting_is_scalar(/* const struct config_setting_t * */ S) \ (((S)->type == CONFIG_TYPE_BOOL) || ((S)->type == CONFIG_TYPE_STRING) \ || config_setting_is_number(S)) #define /* const char * */ config_setting_name( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->name) -#define /* config_setting_t * */ config_setting_parent( \ - /* const config_setting_t * */ S) \ +#define /* struct config_setting_t * */ config_setting_parent( \ + /* const struct config_setting_t * */ S) \ ((S)->parent) #define /* int */ config_setting_is_root( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->parent ? CONFIG_FALSE : CONFIG_TRUE) -extern LIBCONFIG_API int config_setting_index(const config_setting_t *setting); +extern LIBCONFIG_API int config_setting_index(const struct config_setting_t *setting); extern LIBCONFIG_API int config_setting_length( - const config_setting_t *setting); -extern LIBCONFIG_API config_setting_t *config_setting_get_elem( - const config_setting_t *setting, unsigned int idx); + const struct config_setting_t *setting); +extern LIBCONFIG_API struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); -extern LIBCONFIG_API config_setting_t *config_setting_get_member( - const config_setting_t *setting, const char *name); +extern LIBCONFIG_API struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); -extern LIBCONFIG_API config_setting_t *config_setting_add( - config_setting_t *parent, const char *name, int type); -extern LIBCONFIG_API int config_setting_remove(config_setting_t *parent, +extern LIBCONFIG_API struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern LIBCONFIG_API int config_setting_remove(struct config_setting_t *parent, const char *name); -extern LIBCONFIG_API int config_setting_remove_elem(config_setting_t *parent, +extern LIBCONFIG_API int config_setting_remove_elem(struct config_setting_t *parent, unsigned int idx); -extern LIBCONFIG_API void config_setting_set_hook(config_setting_t *setting, +extern LIBCONFIG_API void config_setting_set_hook(struct config_setting_t *setting, void *hook); #define config_setting_get_hook(S) ((S)->hook) -extern LIBCONFIG_API config_setting_t *config_lookup(const config_t *config, +extern LIBCONFIG_API struct config_setting_t *config_lookup(const struct config_t *config, const char *path); -extern LIBCONFIG_API config_setting_t *config_setting_lookup( - config_setting_t *setting, const char *path); +extern LIBCONFIG_API struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); -extern LIBCONFIG_API int config_lookup_int(const config_t *config, +extern LIBCONFIG_API int config_lookup_int(const struct config_t *config, const char *path, int *value); -extern LIBCONFIG_API int config_lookup_int64(const config_t *config, +extern LIBCONFIG_API int config_lookup_int64(const struct config_t *config, const char *path, long long *value); -extern LIBCONFIG_API int config_lookup_float(const config_t *config, +extern LIBCONFIG_API int config_lookup_float(const struct config_t *config, const char *path, double *value); -extern LIBCONFIG_API int config_lookup_bool(const config_t *config, +extern LIBCONFIG_API int config_lookup_bool(const struct config_t *config, const char *path, int *value); -extern LIBCONFIG_API int config_lookup_string(const config_t *config, +extern LIBCONFIG_API int config_lookup_string(const struct config_t *config, const char *path, const char **value); -#define /* config_setting_t * */ config_root_setting( \ - /* const config_t * */ C) \ +#define /* struct config_setting_t * */ config_root_setting( \ + /* const struct config_t * */ C) \ ((C)->root) -#define /* void */ config_set_default_format(/* config_t * */ C, \ +#define /* void */ config_set_default_format(/* struct config_t * */ C, \ /* short */ F) \ (C)->default_format = (F) -#define /* short */ config_get_default_format(/* config_t * */ C) \ +#define /* short */ config_get_default_format(/* struct config_t * */ C) \ ((C)->default_format) -#define /* void */ config_set_tab_width(/* config_t * */ C, \ +#define /* void */ config_set_tab_width(/* struct config_t * */ C, \ /* unsigned short */ W) \ (C)->tab_width = ((W) & 0x0F) -#define /* unsigned char */ config_get_tab_width(/* const config_t * */ C) \ +#define /* unsigned char */ config_get_tab_width(/* const struct config_t * */ C) \ ((C)->tab_width) #define /* unsigned short */ config_setting_source_line( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->line) #define /* const char */ config_setting_source_file( \ - /* const config_setting_t * */ S) \ + /* const struct config_setting_t * */ S) \ ((S)->file) -#define /* const char * */ config_error_text(/* const config_t * */ C) \ +#define /* const char * */ config_error_text(/* const struct config_t * */ C) \ ((C)->error_text) -#define /* const char * */ config_error_file(/* const config_t * */ C) \ +#define /* const char * */ config_error_file(/* const struct config_t * */ C) \ ((C)->error_file) -#define /* int */ config_error_line(/* const config_t * */ C) \ +#define /* int */ config_error_line(/* const struct config_t * */ C) \ ((C)->error_line) -#define /* config_error_t */ config_error_type(/* const config_t * */ C) \ +#define /* enum config_error_t */ config_error_type(/* const struct config_t * */ C) \ ((C)->error_type) #ifdef __cplusplus diff --git a/3rdparty/libconfig/parsectx.h b/3rdparty/libconfig/parsectx.h index 93cc979c9..4d1f261d9 100644 --- a/3rdparty/libconfig/parsectx.h +++ b/3rdparty/libconfig/parsectx.h @@ -28,9 +28,9 @@ struct parse_context { - config_t *config; - config_setting_t *parent; - config_setting_t *setting; + struct config_t *config; + struct config_setting_t *parent; + struct config_setting_t *setting; char *name; strbuf_t string; }; diff --git a/3rdparty/libconfig/scanctx.h b/3rdparty/libconfig/scanctx.h index c8dc22f87..004523e2a 100644 --- a/3rdparty/libconfig/scanctx.h +++ b/3rdparty/libconfig/scanctx.h @@ -33,7 +33,7 @@ struct scan_context { - config_t *config; + struct config_t *config; const char *top_filename; const char *files[MAX_INCLUDE_DEPTH]; void *buffers[MAX_INCLUDE_DEPTH]; diff --git a/src/common/HPM.c b/src/common/HPM.c index 0cb23019a..f115c886e 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -616,8 +616,8 @@ CMDLINEARG(loadplugin) * Reads the plugin configuration and loads the plugins as necessary. */ void hplugins_config_read(void) { - config_t plugins_conf; - config_setting_t *plist = NULL; + struct config_t plugins_conf; + struct config_setting_t *plist = NULL; const char *config_filename = "conf/plugins.conf"; // FIXME hardcoded name FILE *fp; int i; @@ -633,7 +633,7 @@ void hplugins_config_read(void) { plist = libconfig->lookup(&plugins_conf, "plugins_list"); for (i = 0; i < VECTOR_LENGTH(HPM->cmdline_load_plugins); i++) { - config_setting_t *entry = libconfig->setting_add(plist, NULL, CONFIG_TYPE_STRING); + struct config_setting_t *entry = libconfig->setting_add(plist, NULL, CONFIG_TYPE_STRING); config_setting_set_string(entry, VECTOR_INDEX(HPM->cmdline_load_plugins, i)); } diff --git a/src/common/conf.c b/src/common/conf.c index ca9b7cbbc..25f1013f5 100644 --- a/src/common/conf.c +++ b/src/common/conf.c @@ -43,7 +43,7 @@ struct libconfig_interface *libconfig; * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_load_file(config_t *config, const char *config_filename) +int config_load_file(struct config_t *config, const char *config_filename) { libconfig->init(config); if (libconfig->read_file_src(config, config_filename) != CONFIG_TRUE) { @@ -58,12 +58,12 @@ int config_load_file(config_t *config, const char *config_filename) // // Functions to copy settings from libconfig/contrib // -void config_setting_copy_simple(config_setting_t *parent, const config_setting_t *src) { +void config_setting_copy_simple(struct config_setting_t *parent, const struct config_setting_t *src) +{ if (config_setting_is_aggregate(src)) { libconfig->setting_copy_aggregate(parent, src); - } - else { - config_setting_t *set; + } else { + struct config_setting_t *set; if( libconfig->setting_get_member(parent, config_setting_name(src)) != NULL ) return; @@ -87,8 +87,9 @@ void config_setting_copy_simple(config_setting_t *parent, const config_setting_t } } -void config_setting_copy_elem(config_setting_t *parent, const config_setting_t *src) { - config_setting_t *set = NULL; +void config_setting_copy_elem(struct config_setting_t *parent, const struct config_setting_t *src) +{ + struct config_setting_t *set = NULL; if (config_setting_is_aggregate(src)) libconfig->setting_copy_aggregate(parent, src); @@ -107,8 +108,9 @@ void config_setting_copy_elem(config_setting_t *parent, const config_setting_t * } } -void config_setting_copy_aggregate(config_setting_t *parent, const config_setting_t *src) { - config_setting_t *newAgg; +void config_setting_copy_aggregate(struct config_setting_t *parent, const struct config_setting_t *src) +{ + struct config_setting_t *newAgg; int i, n; if( libconfig->setting_get_member(parent, config_setting_name(src)) != NULL ) @@ -130,7 +132,8 @@ void config_setting_copy_aggregate(config_setting_t *parent, const config_settin } } -int config_setting_copy(config_setting_t *parent, const config_setting_t *src) { +int config_setting_copy(struct config_setting_t *parent, const struct config_setting_t *src) +{ if (!config_setting_is_group(parent) && !config_setting_is_list(parent)) return CONFIG_FALSE; @@ -150,7 +153,7 @@ int config_setting_copy(config_setting_t *parent, const config_setting_t *src) { * @return The converted value. * @retval false in case of failure. */ -bool config_setting_get_bool_real(const config_setting_t *setting) +bool config_setting_get_bool_real(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_BOOL) return false; @@ -168,9 +171,9 @@ bool config_setting_get_bool_real(const config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_bool_real(const config_setting_t *setting, const char *name, bool *value) +int config_setting_lookup_bool_real(const struct config_setting_t *setting, const char *name, bool *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if (!member) return CONFIG_FALSE; @@ -191,7 +194,7 @@ int config_setting_lookup_bool_real(const config_setting_t *setting, const char * @return The converted value. * @retval 0 in case of failure. */ -uint32 config_setting_get_uint32(const config_setting_t *setting) +uint32 config_setting_get_uint32(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_INT) return 0; @@ -212,9 +215,9 @@ uint32 config_setting_get_uint32(const config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_uint32(const config_setting_t *setting, const char *name, uint32 *value) +int config_setting_lookup_uint32(const struct config_setting_t *setting, const char *name, uint32 *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if (!member) return CONFIG_FALSE; @@ -235,7 +238,7 @@ int config_setting_lookup_uint32(const config_setting_t *setting, const char *na * @return The converted value. * @retval 0 in case of failure. */ -uint16 config_setting_get_uint16(const config_setting_t *setting) +uint16 config_setting_get_uint16(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_INT) return 0; @@ -258,9 +261,9 @@ uint16 config_setting_get_uint16(const config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_uint16(const config_setting_t *setting, const char *name, uint16 *value) +int config_setting_lookup_uint16(const struct config_setting_t *setting, const char *name, uint16 *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if (!member) return CONFIG_FALSE; @@ -281,7 +284,7 @@ int config_setting_lookup_uint16(const config_setting_t *setting, const char *na * @return The converted value. * @retval 0 in case of failure. */ -int16 config_setting_get_int16(const config_setting_t *setting) +int16 config_setting_get_int16(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_INT) return 0; @@ -304,9 +307,9 @@ int16 config_setting_get_int16(const config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_int16(const config_setting_t *setting, const char *name, int16 *value) +int config_setting_lookup_int16(const struct config_setting_t *setting, const char *name, int16 *value) { - config_setting_t *member = config_setting_get_member(setting, name); + struct config_setting_t *member = config_setting_get_member(setting, name); if (!member) return CONFIG_FALSE; @@ -320,7 +323,7 @@ int config_setting_lookup_int16(const config_setting_t *setting, const char *nam } /** - * Looks up a configuration entry of type CONFIG_TYPE_STRING inside a config_setting_t and copies it into a (non-const) char buffer. + * Looks up a configuration entry of type CONFIG_TYPE_STRING inside a struct config_setting_t and copies it into a (non-const) char buffer. * * @param[in] setting The setting to read. * @param[in] name The setting name to lookup. @@ -330,7 +333,7 @@ int config_setting_lookup_int16(const config_setting_t *setting, const char *nam * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_mutable_string(const config_setting_t *setting, const char *name, char *out, size_t out_size) +int config_setting_lookup_mutable_string(const struct config_setting_t *setting, const char *name, char *out, size_t out_size) { const char *str = NULL; @@ -343,7 +346,7 @@ int config_setting_lookup_mutable_string(const config_setting_t *setting, const } /** - * Looks up a configuration entry of type CONFIG_TYPE_STRING inside a config_t and copies it into a (non-const) char buffer. + * Looks up a configuration entry of type CONFIG_TYPE_STRING inside a struct config_t and copies it into a (non-const) char buffer. * * @param[in] config The configuration to read. * @param[in] name The setting name to lookup. @@ -353,7 +356,7 @@ int config_setting_lookup_mutable_string(const config_setting_t *setting, const * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_lookup_mutable_string(const config_t *config, const char *name, char *out, size_t out_size) +int config_lookup_mutable_string(const struct config_t *config, const char *name, char *out, size_t out_size) { const char *str = NULL; diff --git a/src/common/conf.h b/src/common/conf.h index 3bcb4526f..f2bfcac62 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -29,94 +29,94 @@ * The libconfig interface -- specially for plugins, but we enforce it throughout the core to be consistent **/ struct libconfig_interface { - int (*read) (config_t *config, FILE *stream); - void (*write) (const config_t *config, FILE *stream); + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); /* */ - void (*set_options) (config_t *config, int options); - int (*get_options) (const config_t *config); + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); /* */ - int (*read_string) (config_t *config, const char *str); - int (*read_file_src) (config_t *config, const char *filename); - int (*write_file) (config_t *config, const char *filename); - - void (*set_destructor) (config_t *config, void (*destructor)(void *)); - void (*set_include_dir) (config_t *config, const char *include_dir); - - void (*init) (config_t *config); - void (*destroy) (config_t *config); - - int (*setting_get_int) (const config_setting_t *setting); - long long (*setting_get_int64) (const config_setting_t *setting); - double (*setting_get_float) (const config_setting_t *setting); - - int (*setting_get_bool) (const config_setting_t *setting); - - const char * (*setting_get_string) (const config_setting_t *setting); - - config_setting_t * (*setting_lookup) (config_setting_t *setting, const char *name); - int (*setting_lookup_int) (const config_setting_t *setting, const char *name, int *value); - int (*setting_lookup_int64) (const config_setting_t *setting, const char *name, long long *value); - int (*setting_lookup_float) (const config_setting_t *setting, const char *name, double *value); - int (*setting_lookup_bool) (const config_setting_t *setting, const char *name, int *value); - int (*setting_lookup_string) (const config_setting_t *setting, const char *name, const char **value); - int (*setting_set_int) (config_setting_t *setting ,int value); - int (*setting_set_int64) (config_setting_t *setting, long long value); - int (*setting_set_float) (config_setting_t *setting, double value); - int (*setting_set_bool) (config_setting_t *setting, int value); - int (*setting_set_string) (config_setting_t *setting, const char *value); - - int (*setting_set_format) (config_setting_t *setting, short format); - short (*setting_get_format) (const config_setting_t *setting); - - int (*setting_get_int_elem) (const config_setting_t *setting, int idx); - long long (*setting_get_int64_elem) (const config_setting_t *setting, int idx); - double (*setting_get_float_elem) (const config_setting_t *setting, int idx); - int (*setting_get_bool_elem) (const config_setting_t *setting, int idx); - const char * (*setting_get_string_elem) (const config_setting_t *setting, int idx); - config_setting_t * (*setting_set_int_elem) (config_setting_t *setting, int idx, int value); - config_setting_t * (*setting_set_int64_elem) (config_setting_t *setting, int idx, long long value); - config_setting_t * (*setting_set_float_elem) (config_setting_t *setting, int idx, double value); - config_setting_t * (*setting_set_bool_elem) (config_setting_t *setting, int idx, int value); - config_setting_t * (*setting_set_string_elem) (config_setting_t *setting, int idx, const char *value); - - int (*setting_index) (const config_setting_t *setting); - int (*setting_length) (const config_setting_t *setting); - - config_setting_t * (*setting_get_elem) (const config_setting_t *setting, unsigned int idx); - config_setting_t * (*setting_get_member) (const config_setting_t *setting, const char *name); - - config_setting_t * (*setting_add) (config_setting_t *parent, const char *name, int type); - int (*setting_remove) (config_setting_t *parent, const char *name); - - int (*setting_remove_elem) (config_setting_t *parent, unsigned int idx); - void (*setting_set_hook) (config_setting_t *setting, void *hook); - - config_setting_t * (*lookup) (const config_t *config, const char *filepath); - int (*lookup_int) (const config_t *config, const char *filepath, int *value); - int (*lookup_int64) (const config_t *config, const char *filepath, long long *value); - int (*lookup_float) (const config_t *config, const char *filepath, double *value); - int (*lookup_bool) (const config_t *config, const char *filepath, int *value); - int (*lookup_string) (const config_t *config, const char *filepath, const char **value); + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); /* those are custom and are from src/common/conf.c */ /* Functions to copy settings from libconfig/contrib */ - int (*load_file) (config_t *config, const char *config_filename); - void (*setting_copy_simple) (config_setting_t *parent, const config_setting_t *src); - void (*setting_copy_elem) (config_setting_t *parent, const config_setting_t *src); - void (*setting_copy_aggregate) (config_setting_t *parent, const config_setting_t *src); - int (*setting_copy) (config_setting_t *parent, const config_setting_t *src); + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); /* Functions to get other types */ - bool (*setting_get_bool_real) (const config_setting_t *setting); - uint32 (*setting_get_uint32) (const config_setting_t *setting); - uint16 (*setting_get_uint16) (const config_setting_t *setting); - int16 (*setting_get_int16) (const config_setting_t *setting); - - int (*setting_lookup_bool_real) (const config_setting_t *setting, const char *name, bool *value); - int (*setting_lookup_uint32) (const config_setting_t *setting, const char *name, uint32 *value); - int (*setting_lookup_uint16) (const config_setting_t *setting, const char *name, uint16 *value); - int (*setting_lookup_int16) (const config_setting_t *setting, const char *name, int16 *value); - int (*setting_lookup_mutable_string) (const config_setting_t *setting, const char *name, char *out, size_t out_size); - int (*lookup_mutable_string) (const config_t *config, const char *name, char *out, size_t out_size); + bool (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, bool *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); }; #ifdef HERCULES_CORE diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 956222a7d..9e2ff9898 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -799,8 +799,8 @@ void showmsg_showWarning(const char *string, ...) vShowMessage_(MSG_WARNING, string, ap); va_end(ap); } -void showmsg_showConfigWarning(config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); -void showmsg_showConfigWarning(config_setting_t *config, const char *string, ...) +void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) { StringBuf buf; va_list ap; diff --git a/src/common/showmsg.h b/src/common/showmsg.h index ed8776fb0..85a1527bd 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -118,7 +118,7 @@ struct showmsg_interface { void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); - void (*showConfigWarning) (config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); }; /* the purpose of these macros is simply to not make calling them be an annoyance */ diff --git a/src/common/socket.c b/src/common/socket.c index be144fd50..1fc1b2bff 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1686,7 +1686,7 @@ bool socket_trusted_ip_check(uint32 ip) * @param[in] groupname Current group name, for output/logging reasons. * @return The amount of entries read, zero in case of errors. */ -int socket_net_config_read_sub(config_setting_t *t, struct s_subnet_vector *list, const char *filename, const char *groupname) +int socket_net_config_read_sub(struct config_setting_t *t, struct s_subnet_vector *list, const char *filename, const char *groupname) { int i, len; char ipbuf[64], maskbuf[64]; @@ -1722,7 +1722,7 @@ int socket_net_config_read_sub(config_setting_t *t, struct s_subnet_vector *list */ void socket_net_config_read(const char *filename) { - config_t network_config; + struct config_t network_config; int i; nullpo_retv(filename); diff --git a/src/common/socket.h b/src/common/socket.h index e99278052..5103c3850 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -214,7 +214,7 @@ struct socket_interface { uint32 (*lan_subnet_check) (uint32 ip, struct s_subnet *info); bool (*allowed_ip_check) (uint32 ip); bool (*trusted_ip_check) (uint32 ip); - int (*net_config_read_sub) (config_setting_t *t, struct s_subnet_vector *list, const char *filename, const char *groupname); + int (*net_config_read_sub) (struct config_setting_t *t, struct s_subnet_vector *list, const char *filename, const char *groupname); void (*net_config_read) (const char *filename); }; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 3966ff2f1..eb48adc1d 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3613,7 +3613,7 @@ ACMD(reloadskilldb) * @reloadatcommand - reloads conf/atcommand.conf conf/groups.conf *------------------------------------------*/ ACMD(reloadatcommand) { - config_t run_test; + struct config_t run_test; if (!libconfig->load_file(&run_test, "conf/groups.conf")) { clif->message(fd, msg_fd(fd,1036)); // Error reading groups.conf, reload failed. @@ -10006,8 +10006,8 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa * *------------------------------------------*/ void atcommand_config_read(const char* config_filename) { - config_t atcommand_config; - config_setting_t *aliases = NULL, *help = NULL, *nolog = NULL; + struct config_t atcommand_config; + struct config_setting_t *aliases = NULL, *help = NULL, *nolog = NULL; const char *symbol = NULL; int num_aliases = 0; @@ -10041,7 +10041,7 @@ void atcommand_config_read(const char* config_filename) { int count = libconfig->setting_length(aliases); for (i = 0; i < count; ++i) { - config_setting_t *command; + struct config_setting_t *command; const char *commandname = NULL; int j = 0, alias_count = 0; AtCommandInfo *commandinfo = NULL; @@ -10079,7 +10079,7 @@ void atcommand_config_read(const char* config_filename) { int count = libconfig->setting_length(nolog); for (i = 0; i < count; ++i) { - config_setting_t *command; + struct config_setting_t *command; const char *commandname = NULL; AtCommandInfo *commandinfo = NULL; @@ -10101,7 +10101,7 @@ void atcommand_config_read(const char* config_filename) { int i; for (i = 0; i < count; ++i) { - config_setting_t *command; + struct config_setting_t *command; const char *commandname; AtCommandInfo *commandinfo = NULL; @@ -10144,7 +10144,7 @@ static inline int atcommand_command_type2idx(AtCommandType type) * Loads permissions for groups to use commands. * */ -void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **commands_, size_t sz) +void atcommand_db_load_groups(GroupSettings **groups, struct config_setting_t **commands_, size_t sz) { DBIterator *iter = db_iterator(atcommand->db); AtCommandInfo *atcmd; @@ -10157,7 +10157,7 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command CREATE(atcmd->char_groups, char, sz); for (i = 0; i < sz; i++) { GroupSettings *group = groups[i]; - config_setting_t *commands = commands_[i]; + struct config_setting_t *commands = commands_[i]; int result = 0; int idx = -1; @@ -10178,7 +10178,7 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command } if (commands != NULL) { - config_setting_t *cmd = NULL; + struct config_setting_t *cmd = NULL; // : (only atcommand) if (config_setting_lookup_bool(commands, atcmd->command, &result) && result) { diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 5c4acdf01..384bab20d 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -110,7 +110,7 @@ struct atcommand_interface { bool (*create) (char *name, AtCommandFunc func); bool (*can_use) (struct map_session_data *sd, const char *command); bool (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); - void (*load_groups) (GroupSettings **groups, config_setting_t **commands_, size_t sz); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); AtCommandInfo* (*exists) (const char* name); bool (*msg_read) (const char *cfg_name, bool allow_override); void (*final_msg) (void); diff --git a/src/map/battleground.c b/src/map/battleground.c index 995122d52..d25aef851 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -330,8 +330,8 @@ enum bg_queue_types bg_str2teamtype (const char *str) { } void bg_config_read(void) { - config_t bg_conf; - config_setting_t *data = NULL; + struct config_t bg_conf; + struct config_setting_t *data = NULL; const char *config_filename = "conf/battlegrounds.conf"; // FIXME hardcoded name if (!libconfig->load_file(&bg_conf, config_filename)) @@ -340,8 +340,8 @@ void bg_config_read(void) { data = libconfig->lookup(&bg_conf, "battlegrounds"); if (data != NULL) { - config_setting_t *settings = libconfig->setting_get_elem(data, 0); - config_setting_t *arenas; + struct config_setting_t *settings = libconfig->setting_get_elem(data, 0); + struct config_setting_t *arenas; const char *delay_var; int offline = 0; @@ -361,8 +361,8 @@ void bg_config_read(void) { int arena_count = libconfig->setting_length(arenas); CREATE( bg->arena, struct bg_arena *, arena_count ); for(i = 0; i < arena_count; i++) { - config_setting_t *arena = libconfig->setting_get_elem(arenas, i); - config_setting_t *reward; + struct config_setting_t *arena = libconfig->setting_get_elem(arenas, i); + struct config_setting_t *reward; const char *aName, *aEvent, *aDelayVar, *aTeamTypes; int minLevel = 0, maxLevel = 0; int prizeWin, prizeLoss, prizeDraw; diff --git a/src/map/channel.c b/src/map/channel.c index c1b28fd84..45b59898c 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -589,8 +589,8 @@ void channel_quit_guild(struct map_session_data *sd) void read_channels_config(void) { - config_t channels_conf; - config_setting_t *chsys = NULL; + struct config_t channels_conf; + struct config_setting_t *chsys = NULL; const char *config_filename = "conf/channels.conf"; // FIXME hardcoded name if (!libconfig->load_file(&channels_conf, config_filename)) @@ -599,9 +599,9 @@ void read_channels_config(void) chsys = libconfig->lookup(&channels_conf, "chsys"); if (chsys != NULL) { - config_setting_t *settings = libconfig->setting_get_elem(chsys, 0); - config_setting_t *channels; - config_setting_t *colors; + struct config_setting_t *settings = libconfig->setting_get_elem(chsys, 0); + struct config_setting_t *channels; + struct config_setting_t *colors; int i,k; const char *local_name, *ally_name, *local_color, *ally_color, @@ -710,7 +710,7 @@ void read_channels_config(void) CREATE(channel->config->colors, unsigned int, color_count); CREATE(channel->config->colors_name, char *, color_count); for(i = 0; i < color_count; i++) { - config_setting_t *color = libconfig->setting_get_elem(colors, i); + struct config_setting_t *color = libconfig->setting_get_elem(colors, i); CREATE(channel->config->colors_name[i], char, HCS_NAME_LENGTH); @@ -771,7 +771,7 @@ void read_channels_config(void) int channel_count = libconfig->setting_length(channels); for(i = 0; i < channel_count; i++) { - config_setting_t *chan = libconfig->setting_get_elem(channels, i); + struct config_setting_t *chan = libconfig->setting_get_elem(channels, i); const char *name = config_setting_name(chan); const char *color = libconfig->setting_get_string_elem(channels,i); diff --git a/src/map/clif.c b/src/map/clif.c index 5b9e9c99e..66a8e92b8 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17308,8 +17308,8 @@ void clif_parse_MoveItem(int fd, struct map_session_data *sd) { /* [Ind/Hercules] */ void clif_cashshop_db(void) { - config_t cashshop_conf; - config_setting_t *cashshop = NULL, *cats = NULL; + struct config_t cashshop_conf; + struct config_setting_t *cashshop = NULL, *cats = NULL; const char *config_filename = "db/cashshop_db.conf"; // FIXME hardcoded name int i, item_count_t = 0; for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { @@ -17324,7 +17324,7 @@ void clif_cashshop_db(void) { if( cashshop != NULL && (cats = libconfig->setting_get_elem(cashshop, 0)) != NULL ) { for(i = 0; i < CASHSHOP_TAB_MAX; i++) { - config_setting_t *cat; + struct config_setting_t *cat; char entry_name[10]; sprintf(entry_name,"cat_%d",i); @@ -17333,7 +17333,7 @@ void clif_cashshop_db(void) { int k, item_count = libconfig->setting_length(cat); for(k = 0; k < item_count; k++) { - config_setting_t *entry = libconfig->setting_get_elem(cat,k); + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); const char *name = config_setting_name(entry); int price = libconfig->setting_get_int(entry); struct item_data * data = NULL; @@ -18366,8 +18366,8 @@ void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { } bool clif_parse_roulette_db(void) { - config_t roulette_conf; - config_setting_t *roulette = NULL, *levels = NULL; + struct config_t roulette_conf; + struct config_setting_t *roulette = NULL, *levels = NULL; const char *config_filename = "db/roulette_db.conf"; // FIXME hardcoded name int i, j, item_count_t = 0; @@ -18381,7 +18381,7 @@ bool clif_parse_roulette_db(void) { if( roulette != NULL && (levels = libconfig->setting_get_elem(roulette, 0)) != NULL ) { for(i = 0; i < MAX_ROULETTE_LEVEL; i++) { - config_setting_t *level; + struct config_setting_t *level; char entry_name[10]; sprintf(entry_name,"level_%d",i+1); @@ -18390,7 +18390,7 @@ bool clif_parse_roulette_db(void) { int k, item_count = libconfig->setting_length(level); for(k = 0; k < item_count; k++) { - config_setting_t *entry = libconfig->setting_get_elem(level,k); + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); const char *name = config_setting_name(entry); int qty = libconfig->setting_get_int(entry); struct item_data * data = NULL; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 83535f294..da72ab05a 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -637,8 +637,8 @@ int itemdb_isidentified2(struct item_data *data) { } void itemdb_read_groups(void) { - config_t item_group_conf; - config_setting_t *itg = NULL, *it = NULL; + struct config_t item_group_conf; + struct config_setting_t *itg = NULL, *it = NULL; #ifdef RENEWAL const char *config_filename = "db/re/item_group.conf"; // FIXME hardcoded name #else @@ -927,8 +927,8 @@ bool itemdb_read_cached_packages(const char *config_filename) { return true; } void itemdb_read_packages(void) { - config_t item_packages_conf; - config_setting_t *itg = NULL, *it = NULL, *t = NULL; + struct config_t item_packages_conf; + struct config_setting_t *itg = NULL, *it = NULL, *t = NULL; #ifdef RENEWAL const char *config_filename = "db/re/item_packages.conf"; // FIXME hardcoded name #else @@ -1157,8 +1157,8 @@ void itemdb_read_packages(void) { } void itemdb_read_chains(void) { - config_t item_chain_conf; - config_setting_t *itc = NULL; + struct config_t item_chain_conf; + struct config_setting_t *itc = NULL; #ifdef RENEWAL const char *config_filename = "db/re/item_chain.conf"; // FIXME hardcoded name #else @@ -1180,7 +1180,7 @@ void itemdb_read_chains(void) { struct item_chain_entry *prev = NULL; const char *name = config_setting_name(itc); int c = 0; - config_setting_t *entry = NULL; + struct config_setting_t *entry = NULL; script->set_constant2(name, i-1, false, false); itemdb->chains[count].qty = (unsigned short)libconfig->setting_length(itc); @@ -1529,7 +1529,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { return item->nameid; } -void itemdb_readdb_additional_fields(int itemid, config_setting_t *it, int n, const char *source) +void itemdb_readdb_additional_fields(int itemid, struct config_setting_t *it, int n, const char *source) { // do nothing. plugins can do own work } @@ -1547,9 +1547,9 @@ void itemdb_readdb_additional_fields(int itemid, config_setting_t *it, int n, co * validation errors. * @return Nameid of the validated entry, or 0 in case of failure. */ -int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) { +int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char *source) { struct item_data id = { 0 }; - config_setting_t *t = NULL; + struct config_setting_t *t = NULL; const char *str = NULL; int i32 = 0; bool inherit = false; @@ -1730,7 +1730,7 @@ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) if ( (t = libconfig->setting_get_member(it, "Trade")) ) { if (config_setting_is_group(t)) { - config_setting_t *tt = NULL; + struct config_setting_t *tt = NULL; if ((tt = libconfig->setting_get_member(t, "override"))) { id.gm_lv_trade_override = libconfig->setting_get_int(tt); @@ -1796,7 +1796,7 @@ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) if ((t = libconfig->setting_get_member(it, "Nouse"))) { if (config_setting_is_group(t)) { - config_setting_t *nt = NULL; + struct config_setting_t *nt = NULL; if ((nt = libconfig->setting_get_member(t, "override"))) { id.item_usage.override = libconfig->setting_get_int(nt); @@ -1844,7 +1844,7 @@ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) return itemdb->validate_entry(&id, n, source); } -bool itemdb_lookup_const(const config_setting_t *it, const char *name, int *value) +bool itemdb_lookup_const(const struct config_setting_t *it, const char *name, int *value) { nullpo_retr(false, name); nullpo_retr(false, value); @@ -1873,8 +1873,8 @@ bool itemdb_lookup_const(const config_setting_t *it, const char *name, int *valu */ int itemdb_readdb_libconfig(const char *filename) { bool duplicate[MAX_ITEMDB]; - config_t item_db_conf; - config_setting_t *itdb, *it; + struct config_t item_db_conf; + struct config_setting_t *itdb, *it; char filepath[256]; int i = 0, count = 0; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 8a0ec389d..8c2a7ac53 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -631,8 +631,8 @@ struct itemdb_interface { void (*read_combos) (void); int (*gendercheck) (struct item_data *id); int (*validate_entry) (struct item_data *entry, int n, const char *source); - void (*readdb_additional_fields) (int itemid, config_setting_t *it, int n, const char *source); - int (*readdb_libconfig_sub) (config_setting_t *it, int n, const char *source); + void (*readdb_additional_fields) (int itemid, struct config_setting_t *it, int n, const char *source); + int (*readdb_libconfig_sub) (struct config_setting_t *it, int n, const char *source); int (*readdb_libconfig) (const char *filename); uint64 (*unique_id) (struct map_session_data *sd); void (*read) (bool minimal); @@ -641,7 +641,7 @@ struct itemdb_interface { void (*clear) (bool total); struct item_combo * (*id2combo) (unsigned short id); bool (*is_item_usable) (struct item_data *item); - bool (*lookup_const) (const config_setting_t *it, const char *name, int *value); + bool (*lookup_const) (const struct config_setting_t *it, const char *name, int *value); }; #ifdef HERCULES_CORE diff --git a/src/map/map.c b/src/map/map.c index 3089f7ce0..c17dd9b0e 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -4982,8 +4982,8 @@ enum bl_type map_zone_bl_type(const char *entry, enum map_zone_skill_subtype *su } /* [Ind/Hercules] */ void read_map_zone_db(void) { - config_t map_zone_db; - config_setting_t *zones = NULL; + struct config_t map_zone_db; + struct config_setting_t *zones = NULL; /* TODO: #ifndef required for re/pre-re */ #ifdef RENEWAL const char *config_filename = "db/re/map_zone_db.conf"; // FIXME hardcoded name @@ -4997,12 +4997,12 @@ void read_map_zone_db(void) { if (zones != NULL) { struct map_zone_data *zone; - config_setting_t *zone_e; - config_setting_t *skills; - config_setting_t *items; - config_setting_t *mapflags; - config_setting_t *commands; - config_setting_t *caps; + struct config_setting_t *zone_e; + struct config_setting_t *skills; + struct config_setting_t *items; + struct config_setting_t *mapflags; + struct config_setting_t *commands; + struct config_setting_t *caps; const char *name; const char *zonename; int i,h,v,j; @@ -5054,7 +5054,7 @@ void read_map_zone_db(void) { disabled_skills_count = libconfig->setting_length(skills); /* validate */ for(h = 0; h < libconfig->setting_length(skills); h++) { - config_setting_t *skillinfo = libconfig->setting_get_elem(skills, h); + struct config_setting_t *skillinfo = libconfig->setting_get_elem(skills, h); name = config_setting_name(skillinfo); if( !map->zone_str2skillid(name) ) { ShowError("map_zone_db: unknown skill (%s) in disabled_skills for zone '%s', skipping skill...\n",name,zone->name); @@ -5069,7 +5069,7 @@ void read_map_zone_db(void) { /* all ok, process */ CREATE( zone->disabled_skills, struct map_zone_disabled_skill_entry *, disabled_skills_count ); for(h = 0, v = 0; h < libconfig->setting_length(skills); h++) { - config_setting_t *skillinfo = libconfig->setting_get_elem(skills, h); + struct config_setting_t *skillinfo = libconfig->setting_get_elem(skills, h); struct map_zone_disabled_skill_entry * entry; enum bl_type type; name = config_setting_name(skillinfo); @@ -5092,7 +5092,7 @@ void read_map_zone_db(void) { disabled_items_count = libconfig->setting_length(items); /* validate */ for(h = 0; h < libconfig->setting_length(items); h++) { - config_setting_t *item = libconfig->setting_get_elem(items, h); + struct config_setting_t *item = libconfig->setting_get_elem(items, h); name = config_setting_name(item); if( !map->zone_str2itemid(name) ) { ShowError("map_zone_db: unknown item (%s) in disabled_items for zone '%s', skipping item...\n",name,zone->name); @@ -5111,7 +5111,7 @@ void read_map_zone_db(void) { CREATE(zone->cant_disable_items, int, zone->cant_disable_items_count); } for(h = 0, v = 0, j = 0; h < libconfig->setting_length(items); h++) { - config_setting_t *item = libconfig->setting_get_elem(items, h); + struct config_setting_t *item = libconfig->setting_get_elem(items, h); name = config_setting_name(item); if( libconfig->setting_get_bool(item) ) { /* only add if enabled */ @@ -5143,7 +5143,7 @@ void read_map_zone_db(void) { disabled_commands_count = libconfig->setting_length(commands); /* validate */ for(h = 0; h < libconfig->setting_length(commands); h++) { - config_setting_t *command = libconfig->setting_get_elem(commands, h); + struct config_setting_t *command = libconfig->setting_get_elem(commands, h); name = config_setting_name(command); if( !atcommand->exists(name) ) { ShowError("map_zone_db: unknown command '%s' in disabled_commands for zone '%s', skipping entry...\n",name,zone->name); @@ -5158,7 +5158,7 @@ void read_map_zone_db(void) { /* all ok, process */ CREATE( zone->disabled_commands, struct map_zone_disabled_command_entry *, disabled_commands_count ); for(h = 0, v = 0; h < libconfig->setting_length(commands); h++) { - config_setting_t *command = libconfig->setting_get_elem(commands, h); + struct config_setting_t *command = libconfig->setting_get_elem(commands, h); struct map_zone_disabled_command_entry * entry; int group_lv; name = config_setting_name(command); @@ -5179,7 +5179,7 @@ void read_map_zone_db(void) { capped_skills_count = libconfig->setting_length(caps); /* validate */ for(h = 0; h < libconfig->setting_length(caps); h++) { - config_setting_t *cap = libconfig->setting_get_elem(caps, h); + struct config_setting_t *cap = libconfig->setting_get_elem(caps, h); name = config_setting_name(cap); if( !map->zone_str2skillid(name) ) { ShowError("map_zone_db: unknown skill (%s) in skill_damage_cap for zone '%s', skipping skill...\n",name,zone->name); @@ -5194,7 +5194,7 @@ void read_map_zone_db(void) { /* all ok, process */ CREATE( zone->capped_skills, struct map_zone_skill_damage_cap_entry *, capped_skills_count ); for(h = 0, v = 0; h < libconfig->setting_length(caps); h++) { - config_setting_t *cap = libconfig->setting_get_elem(caps, h); + struct config_setting_t *cap = libconfig->setting_get_elem(caps, h); struct map_zone_skill_damage_cap_entry * entry; enum bl_type type; name = config_setting_name(cap); @@ -5219,8 +5219,8 @@ void read_map_zone_db(void) { /* process inheritance, aka loop through the whole thing again :P */ for (i = 0; i < zone_count; ++i) { - config_setting_t *inherit_tree = NULL; - config_setting_t *new_entry = NULL; + struct config_setting_t *inherit_tree = NULL; + struct config_setting_t *new_entry = NULL; int inherit_count; zone_e = libconfig->setting_get_elem(zones, i); @@ -5278,7 +5278,7 @@ void read_map_zone_db(void) { for(j = 0; j < disabled_skills_count_i; j++) { int k; for(k = 0; k < disabled_skills_count; k++) { - config_setting_t *skillinfo = libconfig->setting_get_elem(skills, k); + struct config_setting_t *skillinfo = libconfig->setting_get_elem(skills, k); if( map->zone_str2skillid(config_setting_name(skillinfo)) == izone->disabled_skills[j]->nameid ) { break; } @@ -5302,7 +5302,7 @@ void read_map_zone_db(void) { for(j = 0; j < disabled_items_count_i; j++) { int k; for(k = 0; k < disabled_items_count; k++) { - config_setting_t *item = libconfig->setting_get_elem(items, k); + struct config_setting_t *item = libconfig->setting_get_elem(items, k); name = config_setting_name(item); @@ -5348,7 +5348,7 @@ void read_map_zone_db(void) { for(j = 0; j < disabled_commands_count_i; j++) { int k; for(k = 0; k < disabled_commands_count; k++) { - config_setting_t *command = libconfig->setting_get_elem(commands, k); + struct config_setting_t *command = libconfig->setting_get_elem(commands, k); if( atcommand->exists(config_setting_name(command))->func == izone->disabled_commands[j]->cmd ) { break; } @@ -5372,7 +5372,7 @@ void read_map_zone_db(void) { for(j = 0; j < capped_skills_count_i; j++) { int k; for(k = 0; k < capped_skills_count; k++) { - config_setting_t *cap = libconfig->setting_get_elem(caps, k); + struct config_setting_t *cap = libconfig->setting_get_elem(caps, k); if( map->zone_str2skillid(config_setting_name(cap)) == izone->capped_skills[j]->nameid ) { break; } diff --git a/src/map/mob.c b/src/map/mob.c index fc6e23427..85e1ad5d5 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3691,7 +3691,7 @@ static inline int mob_parse_dbrow_cap_value(int class_, int min, int max, int va * (mob_id is expected to be already set). * @param[in] t The libconfig entry. */ -void mob_read_db_stats_sub(struct mob_db *entry, config_setting_t *t) +void mob_read_db_stats_sub(struct mob_db *entry, struct config_setting_t *t) { int i32; if (mob->lookup_const(t, "Str", &i32) && i32 >= 0) { @@ -3722,10 +3722,10 @@ void mob_read_db_stats_sub(struct mob_db *entry, config_setting_t *t) * * @return The parsed mode. */ -int mob_read_db_mode_sub(struct mob_db *entry, config_setting_t *t) +int mob_read_db_mode_sub(struct mob_db *entry, struct config_setting_t *t) { int mode = 0; - config_setting_t *t2; + struct config_setting_t *t2; if ((t2 = libconfig->setting_get_member(t, "CanMove"))) mode |= libconfig->setting_get_bool(t2) ? MD_CANMOVE : 0; @@ -3768,9 +3768,9 @@ int mob_read_db_mode_sub(struct mob_db *entry, config_setting_t *t) * (mob_id is expected to be already set). * @param[in] t The libconfig entry. */ -void mob_read_db_mvpdrops_sub(struct mob_db *entry, config_setting_t *t) +void mob_read_db_mvpdrops_sub(struct mob_db *entry, struct config_setting_t *t) { - config_setting_t *drop; + struct config_setting_t *drop; int i = 0; int idx = 0; int i32; @@ -3824,9 +3824,9 @@ void mob_read_db_mvpdrops_sub(struct mob_db *entry, config_setting_t *t) * (mob_id, status.mode are expected to be already set). * @param[in] t The libconfig entry. */ -void mob_read_db_drops_sub(struct mob_db *entry, config_setting_t *t) +void mob_read_db_drops_sub(struct mob_db *entry, struct config_setting_t *t) { - config_setting_t *drop; + struct config_setting_t *drop; int i = 0; int idx = 0; int i32; @@ -4051,10 +4051,10 @@ int mob_db_validate_entry(struct mob_db *entry, int n, const char *source) * validation errors. * @return Mob ID of the validated entry, or 0 in case of failure. */ -int mob_read_db_sub(config_setting_t *mobt, int n, const char *source) +int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *source) { struct mob_db md = { 0 }; - config_setting_t *t = NULL; + struct config_setting_t *t = NULL; const char *str = NULL; int i32 = 0; bool inherit = false; @@ -4359,12 +4359,12 @@ int mob_read_db_sub(config_setting_t *mobt, int n, const char *source) * @param[in] source Source of the entry (file name), to be displayed in * case of validation errors. */ -void mob_read_db_additional_fields(struct mob_db *entry, config_setting_t *t, int n, const char *source) +void mob_read_db_additional_fields(struct mob_db *entry, struct config_setting_t *t, int n, const char *source) { // do nothing. plugins can do own work } -bool mob_lookup_const(const config_setting_t *it, const char *name, int *value) +bool mob_lookup_const(const struct config_setting_t *it, const char *name, int *value) { if (libconfig->setting_lookup_int(it, name, value)) { @@ -4382,7 +4382,7 @@ bool mob_lookup_const(const config_setting_t *it, const char *name, int *value) return false; } -bool mob_get_const(const config_setting_t *it, int *value) +bool mob_get_const(const struct config_setting_t *it, int *value) { const char *str = config_setting_get_string(it); if (str && *str && script->get_constant(str, value)) @@ -4419,10 +4419,10 @@ void mob_readdb(void) { int mob_read_libconfig(const char *filename, bool ignore_missing) { bool duplicate[MAX_MOB_DB] = { 0 }; - config_t mob_db_conf; + struct config_t mob_db_conf; char filepath[256]; - config_setting_t *mdb; - config_setting_t *t; + struct config_setting_t *mdb; + struct config_setting_t *t; int i = 0, count = 0; nullpo_ret(filename); diff --git a/src/map/mob.h b/src/map/mob.h index 9a5239b11..00e2b0723 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -510,16 +510,16 @@ struct mob_interface { unsigned int (*drop_adjust) (int baserate, int rate_adjust, unsigned short rate_min, unsigned short rate_max); void (*item_dropratio_adjust) (int nameid, int mob_id, int *rate_adjust); void (*readdb) (void); - bool (*lookup_const) (const config_setting_t *it, const char *name, int *value); - bool (*get_const) (const config_setting_t *it, int *value); + bool (*lookup_const) (const struct config_setting_t *it, const char *name, int *value); + bool (*get_const) (const struct config_setting_t *it, int *value); int (*db_validate_entry) (struct mob_db *entry, int n, const char *source); int (*read_libconfig) (const char *filename, bool ignore_missing); - void (*read_db_additional_fields) (struct mob_db *entry, config_setting_t *it, int n, const char *source); - int (*read_db_sub) (config_setting_t *mobt, int id, const char *source); - void (*read_db_drops_sub) (struct mob_db *entry, config_setting_t *t); - void (*read_db_mvpdrops_sub) (struct mob_db *entry, config_setting_t *t); - int (*read_db_mode_sub) (struct mob_db *entry, config_setting_t *t); - void (*read_db_stats_sub) (struct mob_db *entry, config_setting_t *t); + void (*read_db_additional_fields) (struct mob_db *entry, struct config_setting_t *it, int n, const char *source); + int (*read_db_sub) (struct config_setting_t *mobt, int id, const char *source); + void (*read_db_drops_sub) (struct mob_db *entry, struct config_setting_t *t); + void (*read_db_mvpdrops_sub) (struct mob_db *entry, struct config_setting_t *t); + int (*read_db_mode_sub) (struct mob_db *entry, struct config_setting_t *t); + void (*read_db_stats_sub) (struct mob_db *entry, struct config_setting_t *t); void (*name_constants) (void); bool (*readdb_mobavail) (char *str[], int columns, int current); int (*read_randommonster) (void); diff --git a/src/map/pc.c b/src/map/pc.c index 8fe1b7c57..fb6fc523c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -10642,8 +10642,8 @@ int pc_split_atoui(char* str, unsigned int* val, char sep, int max) */ void pc_read_skill_tree(void) { - config_t skill_tree_conf; - config_setting_t *skt = NULL; + struct config_t skill_tree_conf; + struct config_setting_t *skt = NULL; char config_filename[128]; int i = 0; struct s_mapiterator *iter; @@ -10656,7 +10656,7 @@ void pc_read_skill_tree(void) // Foreach job while ((skt = libconfig->setting_get_elem(skill_tree_conf.root, i++))) { - config_setting_t *t = NULL; + struct config_setting_t *t = NULL; int job_idx; const char *job_name = config_setting_name(skt); int job_id = pc->check_job_name(job_name); @@ -10746,11 +10746,11 @@ void pc_read_skill_tree(void) } if ((t = libconfig->setting_get_member(skt, "skills")) != NULL) { int j = 0; - config_setting_t *sk = NULL; + struct config_setting_t *sk = NULL; // Foreach skill while ((sk = libconfig->setting_get_elem(t, j++)) != NULL) { int skill_id, sk_idx; - config_setting_t *rsk = NULL; + struct config_setting_t *rsk = NULL; const char *sk_name = config_setting_name(sk); struct skill_tree_entry *tree_entry = NULL; diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index 5a86030fc..72935adc3 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -63,8 +63,8 @@ static inline GroupSettings* name2group(const char* group_name) * @private */ static void read_config(void) { - config_t pc_group_config; - config_setting_t *groups = NULL; + struct config_t pc_group_config; + struct config_setting_t *groups = NULL; const char *config_filename = "conf/groups.conf"; // FIXME hardcoded name int group_count = 0; @@ -83,7 +83,7 @@ static void read_config(void) { int id = 0, level = 0; const char *groupname = NULL; int log_commands = 0; - config_setting_t *group = libconfig->setting_get_elem(groups, i); + struct config_setting_t *group = libconfig->setting_get_elem(groups, i); if (!libconfig->setting_lookup_int(group, "id", &id)) { ShowConfigWarning(group, "pc_groups:read_config: \"groups\" list member #%d has undefined id, removing...", i); @@ -106,7 +106,7 @@ static void read_config(void) { if (!libconfig->setting_lookup_string(group, "name", &groupname)) { char temp[20]; - config_setting_t *name = NULL; + struct config_setting_t *name = NULL; snprintf(temp, sizeof(temp), "Group %d", id); if ((name = config_setting_add(group, "name", CONFIG_TYPE_STRING)) == NULL || !config_setting_set_string(name, temp)) { @@ -148,7 +148,7 @@ static void read_config(void) { // Check if all commands and permissions exist iter = db_iterator(pcg->db); for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) { - config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions; + struct config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions; int count = 0; // Make sure there is "commands" group @@ -157,7 +157,7 @@ static void read_config(void) { count = libconfig->setting_length(commands); for (i = 0; i < count; ++i) { - config_setting_t *command = libconfig->setting_get_elem(commands, i); + struct config_setting_t *command = libconfig->setting_get_elem(commands, i); const char *name = config_setting_name(command); if (!atcommand->exists(name)) { ShowConfigWarning(command, "pc_groups:read_config: non-existent command name '%s', removing...", name); @@ -173,7 +173,7 @@ static void read_config(void) { count = libconfig->setting_length(permissions); for(i = 0; i < count; ++i) { - config_setting_t *permission = libconfig->setting_get_elem(permissions, i); + struct config_setting_t *permission = libconfig->setting_get_elem(permissions, i); const char *name = config_setting_name(permission); int j; @@ -193,7 +193,7 @@ static void read_config(void) { while (i < group_count) { iter = db_iterator(pcg->db); for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) { - config_setting_t *inherit = NULL, + struct config_setting_t *inherit = NULL, *commands = group_settings->commands, *permissions = group_settings->permissions; int j, inherit_count = 0, done = 0; @@ -258,11 +258,11 @@ static void read_config(void) { // Pack permissions into GroupSettings.e_permissions for faster checking iter = db_iterator(pcg->db); for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) { - config_setting_t *permissions = group_settings->permissions; + struct config_setting_t *permissions = group_settings->permissions; int count = libconfig->setting_length(permissions); for (i = 0; i < count; ++i) { - config_setting_t *perm = libconfig->setting_get_elem(permissions, i); + struct config_setting_t *perm = libconfig->setting_get_elem(permissions, i); const char *name = config_setting_name(perm); int val = libconfig->setting_get_bool(perm); int j; @@ -280,9 +280,9 @@ static void read_config(void) { // to atcommand->load_group() for processing. if (group_count > 0) { GroupSettings **pc_groups = NULL; - config_setting_t **commands = NULL; + struct config_setting_t **commands = NULL; CREATE(pc_groups, GroupSettings*, group_count); - CREATE(commands, config_setting_t*, group_count); + CREATE(commands, struct config_setting_t*, group_count); i = 0; iter = db_iterator(pcg->db); for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) { diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index 62704fb12..52ad25191 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -66,11 +66,11 @@ struct GroupSettings { bool log_commands; // groups.[].log_commands int index; // internal index of the group (contiguous range starting at 0) [Ind] /// Following are used/available only during config reading - config_setting_t *commands; // groups.[].commands - config_setting_t *permissions; // groups.[].permissions - config_setting_t *inherit; // groups.[].inherit + struct config_setting_t *commands; // groups.[].commands + struct config_setting_t *permissions; // groups.[].permissions + struct config_setting_t *inherit; // groups.[].inherit bool inheritance_done; // have all inheritance rules been evaluated? - config_setting_t *root; // groups.[] + struct config_setting_t *root; // groups.[] }; typedef struct GroupSettings GroupSettings; diff --git a/src/map/quest.c b/src/map/quest.c index 9af7c8ea2..7e2421c79 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -425,10 +425,10 @@ int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type * @return The parsed quest entry. * @retval NULL in case of errors. */ -struct quest_db *quest_read_db_sub(config_setting_t *cs, int n, const char *source) +struct quest_db *quest_read_db_sub(struct config_setting_t *cs, int n, const char *source) { struct quest_db *entry = NULL; - config_setting_t *t = NULL; + struct config_setting_t *t = NULL; int i32 = 0, quest_id; const char *str = NULL; /* @@ -477,7 +477,7 @@ struct quest_db *quest_read_db_sub(config_setting_t *cs, int n, const char *sour for (i = 0; i < len && entry->objectives_count < MAX_QUEST_OBJECTIVES; i++) { // Note: We ensure that objectives_count < MAX_QUEST_OBJECTIVES because // quest_log (as well as the client) expect this maximum size. - config_setting_t *tt = libconfig->setting_get_elem(t, i); + struct config_setting_t *tt = libconfig->setting_get_elem(t, i); int mob_id = 0, count = 0; if (!tt) break; @@ -496,7 +496,7 @@ struct quest_db *quest_read_db_sub(config_setting_t *cs, int n, const char *sour if ((t=libconfig->setting_get_member(cs, "Drops")) && config_setting_is_list(t)) { int i, len = libconfig->setting_length(t); for (i = 0; i < len; i++) { - config_setting_t *tt = libconfig->setting_get_elem(t, i); + struct config_setting_t *tt = libconfig->setting_get_elem(t, i); int mob_id = 0, nameid = 0, rate = 0; if (!tt) break; @@ -527,8 +527,8 @@ struct quest_db *quest_read_db_sub(config_setting_t *cs, int n, const char *sour int quest_read_db(void) { char filepath[256]; - config_t quest_db_conf; - config_setting_t *qdb = NULL, *q = NULL; + struct config_t quest_db_conf; + struct config_setting_t *qdb = NULL, *q = NULL; int i = 0, count = 0; const char *filename = "quest_db.conf"; diff --git a/src/map/quest.h b/src/map/quest.h index 8e2cb4e23..a4d778219 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -77,7 +77,7 @@ struct quest_interface { int (*check) (struct map_session_data *sd, int quest_id, enum quest_check_type type); void (*clear) (void); int (*read_db) (void); - struct quest_db *(*read_db_sub) (config_setting_t *cs, int n, const char *source); + struct quest_db *(*read_db_sub) (struct config_setting_t *cs, int n, const char *source); }; #ifdef HERCULES_CORE diff --git a/src/map/script.c b/src/map/script.c index eb8879a2a..e6a9c8ae4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2289,10 +2289,10 @@ void script_set_constant2(const char *name, int value, bool is_parameter, bool i */ void read_constdb(void) { - config_t constants_conf; + struct config_t constants_conf; char filepath[256]; - config_setting_t *cdb; - config_setting_t *t; + struct config_setting_t *cdb; + struct config_setting_t *t; int i = 0; sprintf(filepath, "%s/constants.conf", map->db_path); @@ -4803,9 +4803,9 @@ uint8 script_add_language(const char *name) { * Goes thru db/translations.conf file **/ void script_load_translations(void) { - config_t translations_conf; + struct config_t translations_conf; const char *config_filename = "db/translations.conf"; // FIXME hardcoded name - config_setting_t *translations = NULL; + struct config_setting_t *translations = NULL; int i, size; uint32 total = 0; uint8 lang_id = 0, k; diff --git a/src/map/status.c b/src/map/status.c index 32f7bc2d8..39df5c693 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -12556,9 +12556,9 @@ int status_get_sc_type(sc_type type) { return status->dbs->sc_conf[type]; } -void status_read_job_db_sub(int idx, const char *name, config_setting_t *jdb) +void status_read_job_db_sub(int idx, const char *name, struct config_setting_t *jdb) { - config_setting_t *temp = NULL; + struct config_setting_t *temp = NULL; int i32 = 0; struct { @@ -12698,7 +12698,7 @@ void status_read_job_db_sub(int idx, const char *name, config_setting_t *jdb) if ((temp = libconfig->setting_get_member(jdb, "BaseASPD"))) { int widx = 0; - config_setting_t *wpn = NULL; + struct config_setting_t *wpn = NULL; while ((wpn = libconfig->setting_get_elem(temp, widx++))) { int w, wlen = ARRAYLENGTH(wnames); const char *wname = config_setting_name(wpn); @@ -12714,7 +12714,7 @@ void status_read_job_db_sub(int idx, const char *name, config_setting_t *jdb) if ((temp = libconfig->setting_get_member(jdb, "HPTable"))) { int level = 0, avg_increment, base; - config_setting_t *hp = NULL; + struct config_setting_t *hp = NULL; while (level <= MAX_LEVEL && (hp = libconfig->setting_get_elem(temp, level)) != NULL) { i32 = libconfig->setting_get_int(hp); status->dbs->HP_table[idx][++level] = min(i32, battle_config.max_hp); @@ -12734,7 +12734,7 @@ void status_read_job_db_sub(int idx, const char *name, config_setting_t *jdb) if ((temp = libconfig->setting_get_member(jdb, "SPTable"))) { int level = 0, avg_increment, base; - config_setting_t *sp = NULL; + struct config_setting_t *sp = NULL; while (level <= MAX_LEVEL && (sp = libconfig->setting_get_elem(temp, level)) != NULL) { i32 = libconfig->setting_get_int(sp); status->dbs->SP_table[idx][++level] = min(i32, battle_config.max_sp); @@ -12762,8 +12762,8 @@ void status_read_job_db_sub(int idx, const char *name, config_setting_t *jdb) *------------------------------------------*/ void status_read_job_db(void) { /* [malufett/Hercules] */ int i = 0; - config_t job_db_conf; - config_setting_t *jdb = NULL; + struct config_t job_db_conf; + struct config_setting_t *jdb = NULL; #ifdef RENEWAL_ASPD const char *config_filename = "db/re/job_db.conf"; #else @@ -12832,9 +12832,9 @@ bool status_readdb_sizefix(char* fields[], int columns, int current) * validation errors. * @return # of the validated entry, or 0 in case of failure. */ -int status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, const char *source) +int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *name, const char *source) { - config_setting_t *rate = NULL; + struct config_setting_t *rate = NULL; int type = REFINE_TYPE_ARMOR, bonus_per_level = 0, rnd_bonus_v = 0, rnd_bonus_lv = 0; char lv[4]; nullpo_ret(r); @@ -12865,7 +12865,7 @@ int status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, co } if ((rate=libconfig->setting_get_member(r, "Rates")) != NULL && config_setting_is_group(rate)) { - config_setting_t *t = NULL; + struct config_setting_t *t = NULL; bool duplicate[MAX_REFINE]; int bonus[MAX_REFINE], rnd_bonus[MAX_REFINE], chance[MAX_REFINE]; int i; @@ -12925,8 +12925,8 @@ int status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, co */ int status_readdb_refine_libconfig(const char *filename) { bool duplicate[REFINE_TYPE_MAX]; - config_t refine_db_conf; - config_setting_t *r; + struct config_t refine_db_conf; + struct config_setting_t *r; char filepath[256]; int i = 0, count = 0,type = 0; diff --git a/src/map/status.h b/src/map/status.h index be6d4c209..1f28826a5 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2298,10 +2298,10 @@ struct status_interface { bool (*readdb_job2) (char *fields[], int columns, int current); bool (*readdb_sizefix) (char *fields[], int columns, int current); int (*readdb_refine_libconfig) (const char *filename); - int (*readdb_refine_libconfig_sub) (config_setting_t *r, const char *name, const char *source); + int (*readdb_refine_libconfig_sub) (struct config_setting_t *r, const char *name, const char *source); bool (*readdb_scconfig) (char *fields[], int columns, int current); void (*read_job_db) (void); - void (*read_job_db_sub) (int idx, const char *name, config_setting_t *jdb); + void (*read_job_db_sub) (int idx, const char *name, struct config_setting_t *jdb); }; #ifdef HERCULES_CORE diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index 44e2bac3c..ee6b0548a 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -65,9 +65,9 @@ bool itemdb2sql_torun = false; bool mobdb2sql_torun = false; /// Backup of the original item_db parser function pointer. -int (*itemdb_readdb_libconfig_sub) (config_setting_t *it, int n, const char *source); +int (*itemdb_readdb_libconfig_sub) (struct config_setting_t *it, int n, const char *source); /// Backup of the original mob_db parser function pointer. -int (*mob_read_db_sub) (config_setting_t *it, int n, const char *source); +int (*mob_read_db_sub) (struct config_setting_t *it, int n, const char *source); /** * Normalizes and appends a string to the output buffer. @@ -124,7 +124,7 @@ void db2sql_fileheader(void) * * @see itemdb_readdb_libconfig_sub. */ -int itemdb2sql_sub(config_setting_t *entry, int n, const char *source) +int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source) { struct item_data *it = NULL; @@ -134,7 +134,7 @@ int itemdb2sql_sub(config_setting_t *entry, int n, const char *source) char *str; int i32; uint32 ui32; - config_setting_t *t = NULL; + struct config_setting_t *t = NULL; StringBuf buf; nullpo_ret(entry); @@ -424,7 +424,7 @@ void do_itemdb2sql(void) * * @see mobdb_readdb_libconfig_sub. */ -int mobdb2sql_sub(config_setting_t *mobt, int n, const char *source) +int mobdb2sql_sub(struct config_setting_t *mobt, int n, const char *source) { struct mob_db *md = NULL; nullpo_ret(mobt); diff --git a/src/test/test_libconfig.c b/src/test/test_libconfig.c index e5e6b4d70..a3b233b98 100644 --- a/src/test/test_libconfig.c +++ b/src/test/test_libconfig.c @@ -71,7 +71,7 @@ static const char *test_libconfig_defaults(void) static const char *test_libconfig_init_destroy(void) { - config_t config; + struct config_t config; libconfig->init(&config); if (config.root == NULL || config.root != config_root_setting(&config)) { return "Unable to create config."; @@ -85,7 +85,7 @@ static const char *test_libconfig_init_destroy(void) static const char *test_libconfig_read_file_src(void) { - config_t config; + struct config_t config; #define FILENAME "src/test/libconfig/test.conf" if (libconfig->read_file_src(&config, FILENAME) == CONFIG_FALSE) { libconfig->destroy(&config); @@ -102,7 +102,7 @@ static const char *test_libconfig_read_file_src(void) static const char *test_libconfig_read(void) { - config_t config; + struct config_t config; #define FILENAME "src/test/libconfig/test.conf" FILE *fp = fopen(FILENAME, "r"); if (!fp) { @@ -124,7 +124,7 @@ static const char *test_libconfig_read(void) static const char *test_libconfig_load_file(void) { - config_t config; + struct config_t config; #define FILENAME "src/test/libconfig/test.conf" if (libconfig->load_file(&config, FILENAME) == CONFIG_FALSE) { return "Unable to read file '" FILENAME "'."; @@ -140,19 +140,19 @@ static const char *test_libconfig_load_file(void) static const char *test_libconfig_write(void) { - //void (*write) (const config_t *config, FILE *stream); + //void (*write) (const struct config_t *config, FILE *stream); return "TEST NOT IMPLEMENTED"; } static const char *test_libconfig_write_file(void) { - //int (*write_file) (config_t *config, const char *filename); + //int (*write_file) (struct config_t *config, const char *filename); return "TEST NOT IMPLEMENTED"; } static const char *test_libconfig_read_string(void) { - config_t config; + struct config_t config; if (libconfig->read_string(&config, "") == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to read from string."; @@ -167,7 +167,7 @@ static const char *test_libconfig_read_string(void) static const char *test_libconfig_syntax(void) { - config_t config; + struct config_t config; const char *input = "/* Test File */\n" "Setting_Int: 1;\n" "Setting_Int64: 1L;\n" @@ -193,14 +193,14 @@ static const char *test_libconfig_syntax(void) static const char *test_libconfig_set_include_dir(void) { - //void (*set_include_dir) (config_t *config, const char *include_dir); + //void (*set_include_dir) (struct config_t *config, const char *include_dir); return "TEST NOT IMPLEMENTED"; } static const char *test_libconfig_lookup(void) { - config_t config; - config_setting_t *t = NULL; + struct config_t config; + struct config_setting_t *t = NULL; int32 i32; int64 i64; double f; @@ -263,8 +263,8 @@ static const char *test_libconfig_lookup(void) static const char *test_libconfig_setting_get(void) { - config_t config; - config_setting_t *t = NULL; + struct config_t config; + struct config_setting_t *t = NULL; double f; const char *str; const char *input = "/* Test File */\n" @@ -366,17 +366,17 @@ static const char *test_libconfig_setting_get(void) static const char *test_libconfig_set(void) { - //int (*setting_set_int) (config_setting_t *setting ,int value); - //int (*setting_set_int64) (config_setting_t *setting, long long value); - //int (*setting_set_float) (config_setting_t *setting, double value); - //int (*setting_set_bool) (config_setting_t *setting, int value); - //int (*setting_set_string) (config_setting_t *setting, const char *value); + //int (*setting_set_int) (struct config_setting_t *setting ,int value); + //int (*setting_set_int64) (struct config_setting_t *setting, long long value); + //int (*setting_set_float) (struct config_setting_t *setting, double value); + //int (*setting_set_bool) (struct config_setting_t *setting, int value); + //int (*setting_set_string) (struct config_setting_t *setting, const char *value); return "TEST NOT IMPLEMENTED"; } static const char *test_libconfig_setting_lookup(void) { - config_t config; + struct config_t config; int32 i32; int64 i64; double f; @@ -429,8 +429,8 @@ static const char *test_libconfig_setting_lookup(void) static const char *test_libconfig_setting_types(void) { - config_t config; - config_setting_t *t; + struct config_t config; + struct config_setting_t *t; const char *input = "/* Test File */\n" "Setting_Int: 1;\n" "Setting_Int64: 1L;\n" @@ -523,7 +523,7 @@ static const char *test_libconfig_setting_types(void) static const char *test_libconfig_values(void) { - config_t config; + struct config_t config; int32 i32; int64 i64; const char *input = "/* Test File */\n" @@ -583,7 +583,7 @@ static const char *test_libconfig_values(void) static const char *test_libconfig_path_lookup(void) { - config_t config; + struct config_t config; int32 i32; const char *input = "/* Test File */\n" "Setting_Array: [1, 2, 3];\n" @@ -666,7 +666,7 @@ static const char *test_libconfig_path_lookup(void) static const char *test_libconfig_setting_names(void) { - config_t config; + struct config_t config; int32 i32; const char *input = "/* Test File */\n" "Setting'with'apostrophes: 1;\n" @@ -724,9 +724,9 @@ static const char *test_libconfig_setting_names(void) static const char *test_libconfig_duplicate_keys(void) { - config_t config; + struct config_t config; int32 i32; - config_setting_t *t, *tt; + struct config_setting_t *t, *tt; int i = 0; const char *input = "/* Test File */\n" "Setting_Group: {\n" @@ -775,7 +775,7 @@ static const char *test_libconfig_duplicate_keys(void) static const char *test_libconfig_special_string_syntax(void) { - config_t config; + struct config_t config; const char *str; const char *input = "/* Test File */\n" "SpecialString: <\"This is an \"Item_Script\" Special String\n\tWith a line-break inside.\">;\n" @@ -815,27 +815,27 @@ int do_init(int argc, char **argv) TEST("libconfig->read_string", test_libconfig_read_string); TEST("libconfig syntax", test_libconfig_syntax); (void)test_libconfig_set_include_dir; //TEST("libconfig->set_include_dir", test_libconfig_set_include_dir); - //int (*setting_set_format) (config_setting_t *setting, short format); - //short (*setting_get_format) (const config_setting_t *setting); - //config_setting_t * (*setting_set_int_elem) (config_setting_t *setting, int idx, int value); - //config_setting_t * (*setting_set_int64_elem) (config_setting_t *setting, int idx, long long value); - //config_setting_t * (*setting_set_float_elem) (config_setting_t *setting, int idx, double value); - //config_setting_t * (*setting_set_bool_elem) (config_setting_t *setting, int idx, int value); - //config_setting_t * (*setting_set_string_elem) (config_setting_t *setting, int idx, const char *value); - //config_setting_t * (*setting_add) (config_setting_t *parent, const char *name, int type); - //int (*setting_remove) (config_setting_t *parent, const char *name); - //int (*setting_remove_elem) (config_setting_t *parent, unsigned int idx); - //void (*setting_set_hook) (config_setting_t *setting, void *hook); - //void (*set_destructor) (config_t *config, void (*destructor)(void *)); + //int (*setting_set_format) (struct config_setting_t *setting, short format); + //short (*setting_get_format) (const struct config_setting_t *setting); + //struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + //struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + //struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + //struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + //struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + //struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + //int (*setting_remove) (struct config_setting_t *parent, const char *name); + //int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + //void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + //void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); TEST("libconfig->lookup_*", test_libconfig_lookup); TEST("libconfig->setting_get_*", test_libconfig_setting_get); (void)test_libconfig_set; //TEST("libconfig->setting_set_*", test_libconfig_setting_set); TEST("libconfig->setting_lookup_*", test_libconfig_setting_lookup); TEST("setting types", test_libconfig_setting_types); - //void (*setting_copy_simple) (config_setting_t *parent, const config_setting_t *src); - //void (*setting_copy_elem) (config_setting_t *parent, const config_setting_t *src); - //void (*setting_copy_aggregate) (config_setting_t *parent, const config_setting_t *src); - //int (*setting_copy) (config_setting_t *parent, const config_setting_t *src); + //void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + //void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + //void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + //int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); TEST("values", test_libconfig_values); TEST("path lookup", test_libconfig_path_lookup); TEST("setting key names", test_libconfig_setting_names); -- cgit v1.2.3-70-g09d2