diff options
author | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
---|---|---|
committer | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
commit | f52e1007fe08c67003c0bc4c78231904dd3fd5cc (patch) | |
tree | 99907d827264e501774e58ab4630e41fa7103c02 /3rdparty/libconfig/libconfig.c | |
parent | 2410110dece79b4598c12f1c953219f1d0d1904a (diff) | |
parent | 769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6 (diff) | |
download | hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.gz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.bz2 hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.xz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.zip |
Merge pull request #1 from HerculesWS/master
Update from original
Diffstat (limited to '3rdparty/libconfig/libconfig.c')
-rw-r--r-- | 3rdparty/libconfig/libconfig.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/3rdparty/libconfig/libconfig.c b/3rdparty/libconfig/libconfig.c index 2e90315c6..358c415f5 100644 --- a/3rdparty/libconfig/libconfig.c +++ b/3rdparty/libconfig/libconfig.c @@ -96,7 +96,8 @@ static void __config_locale_override(void) #else -/* locale overriding is pretty pointless (rathena doesn't make use of the area that uses locale functionality), but I'm actually removing it because it floods the buildbot with warnings */ +/* locale overriding is pretty pointless (Hercules doesn't make use of the area that uses locale functionality), + * but I'm actually removing it because it floods the buildbot with warnings */ //#warning "No way to modify calling thread's locale!" #endif @@ -118,7 +119,8 @@ static void __config_locale_restore(void) #else -/* locale overriding is pretty pointless (rathena doesn't make use of the area that uses locale functionality), but I'm actually removing it because it floods the buildbot with warnings */ +/* locale overriding is pretty pointless (Hercules doesn't make use of the area that uses locale functionality), + * but I'm actually removing it because it floods the buildbot with warnings */ //#warning "No way to modify calling thread's locale!" #endif @@ -535,12 +537,12 @@ static int __config_validate_name(const char *name) if(*p == '\0') return(CONFIG_FALSE); - if(! isalpha((unsigned char)*p) && (*p != '*')) + if(! isalpha((int)*p) && (*p != '*')) return(CONFIG_FALSE); for(++p; *p; ++p) { - if(! (isalpha((unsigned char)*p) || isdigit((unsigned char)*p) || strchr("*_-", (int)*p))) + if(! (isalpha((int)*p) || isdigit((int)*p) || strchr("*_-'", (int)*p))) return(CONFIG_FALSE); } @@ -555,7 +557,7 @@ 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; + /*YY_BUFFER_STATE buffer = NULL;*/ int r; /* Reinitialize the config */ @@ -587,7 +589,7 @@ static int __config_read(config_t *config, FILE *stream, const char *filename, if(stream) libconfig_yyrestart(stream, scanner); else /* read from string */ - buffer = libconfig_yy_scan_string(str, scanner); + /*buffer = */libconfig_yy_scan_string(str, scanner); libconfig_yyset_lineno(1, scanner); r = libconfig_yyparse(scanner, &parse_ctx, &scan_ctx); @@ -1537,8 +1539,17 @@ config_setting_t *config_setting_add(config_setting_t *parent, return(NULL); } +#if 0 + /* https://github.com/HerculesWS/Hercules/pull/136#discussion_r6363319 + * With this code, accidental duplicate keys would cause the file parsing to fail + * (would cause several issues during runtime on file reloads), while libconfig's code + * has no problems with duplicate members so it was ducked out -- TODO: looking now though + * I'd think it could be useful to have it display a warning or error message when finding + * duplicate keys instead of silently moving on. [Ind] + */ if(config_setting_get_member(parent, name) != NULL) return(NULL); /* already exists */ +#endif return(config_setting_create(parent, name, type)); } |