summaryrefslogtreecommitdiff
path: root/3rdparty/libconfig/libconfig.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-09 12:59:55 +0200
committerHaru <haru@dotalux.com>2013-09-17 01:56:14 +0200
commitb8bf9548d76a46650b8559d621e81072d340bc04 (patch)
tree8fc00bb11a6067eaf464f525ea9b4968085113af /3rdparty/libconfig/libconfig.c
parente38d423d76d8e2c8001eade66a4aceca92de15c0 (diff)
downloadhercules-b8bf9548d76a46650b8559d621e81072d340bc04.tar.gz
hercules-b8bf9548d76a46650b8559d621e81072d340bc04.tar.bz2
hercules-b8bf9548d76a46650b8559d621e81072d340bc04.tar.xz
hercules-b8bf9548d76a46650b8559d621e81072d340bc04.zip
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 <haru@dotalux.com>
Diffstat (limited to '3rdparty/libconfig/libconfig.c')
-rw-r--r--3rdparty/libconfig/libconfig.c25
1 files changed, 20 insertions, 5 deletions
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));
}