summaryrefslogtreecommitdiff
path: root/3rdparty/libconfig/libconfig.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-09-17 09:05:05 -0300
committershennetsind <ind@henn.et>2013-09-17 09:05:05 -0300
commit2884b361c247a66c91188cfeb924e1794d58da55 (patch)
tree27e320d09fe8672dd141e7878273170d8ce25e44 /3rdparty/libconfig/libconfig.c
parent35c131c7ff945bff238e3e242e513b5fe42a0067 (diff)
parente6a9f7cfdb5ee6d27c12d35f2ecf8317595317b6 (diff)
downloadhercules-2884b361c247a66c91188cfeb924e1794d58da55.tar.gz
hercules-2884b361c247a66c91188cfeb924e1794d58da55.tar.bz2
hercules-2884b361c247a66c91188cfeb924e1794d58da55.tar.xz
hercules-2884b361c247a66c91188cfeb924e1794d58da55.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
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));
}