From b8bf9548d76a46650b8559d621e81072d340bc04 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 9 Sep 2013 12:59:55 +0200 Subject: Updated libconfig to version 1.4.9 Previous edits to the library have been preserved with this update. No functional changes, other than some edge-case fixes (see libconfig changelog). In case of issues, please let me know / file a bugreport. Signed-off-by: Haru --- 3rdparty/libconfig/libconfig.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to '3rdparty/libconfig/libconfig.c') diff --git a/3rdparty/libconfig/libconfig.c b/3rdparty/libconfig/libconfig.c index e2c583310..194c891be 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); } @@ -1531,11 +1533,24 @@ config_setting_t *config_setting_add(config_setting_t *parent, if((parent->type == CONFIG_TYPE_ARRAY) || (parent->type == CONFIG_TYPE_LIST)) name = NULL; - if(name) { + if(name) + { if(! __config_validate_name(name)) 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)); } -- cgit v1.2.3-60-g2f50