summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-16 13:31:41 +0100
committerHaru <haru@dotalux.com>2016-02-17 10:40:43 +0100
commit5b673efa121320d1575e126243fa2c7ec460952d (patch)
tree609fa0a08bf4065a07ccb469039df43e96d095ee /src/common
parent6c127b3ec4f73f02aff5b37e9526dcc249d95c54 (diff)
downloadhercules-5b673efa121320d1575e126243fa2c7ec460952d.tar.gz
hercules-5b673efa121320d1575e126243fa2c7ec460952d.tar.bz2
hercules-5b673efa121320d1575e126243fa2c7ec460952d.tar.xz
hercules-5b673efa121320d1575e126243fa2c7ec460952d.zip
Renamed config->read_file to config->load_file
- The return value is now consistent with the libconfig standard (CONFIG_TRUE/CONFIG_FALSE). - Removed some redundant error messages. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/HPM.c2
-rw-r--r--src/common/conf.c16
-rw-r--r--src/common/conf.h2
-rw-r--r--src/common/socket.c2
4 files changed, 12 insertions, 10 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index d9c3262d7..0cb23019a 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -628,7 +628,7 @@ void hplugins_config_read(void) {
fclose(fp);
}
- if (libconfig->read_file(&plugins_conf, config_filename))
+ if (!libconfig->load_file(&plugins_conf, config_filename))
return;
plist = libconfig->lookup(&plugins_conf, "plugins_list");
diff --git a/src/common/conf.c b/src/common/conf.c
index b7c4f0734..ca9b7cbbc 100644
--- a/src/common/conf.c
+++ b/src/common/conf.c
@@ -32,7 +32,7 @@ struct libconfig_interface libconfig_s;
struct libconfig_interface *libconfig;
/**
- * Initializes 'config' and reads a configuration file.
+ * Initializes 'config' and loads a configuration file.
*
* Shows error and destroys 'config' in case of failure.
* It is the caller's care to destroy 'config' in case of success.
@@ -40,17 +40,19 @@ struct libconfig_interface *libconfig;
* @param config The config file to initialize.
* @param config_filename The file to read.
*
- * @retval 1 in case of failure.
+ * @retval CONFIG_TRUE in case of success.
+ * @retval CONFIG_FALSE in case of failure.
*/
-int conf_read_file(config_t *config, const char *config_filename) {
+int config_load_file(config_t *config, const char *config_filename)
+{
libconfig->init(config);
- if (!libconfig->read_file_src(config, config_filename)) {
+ if (libconfig->read_file_src(config, config_filename) != CONFIG_TRUE) {
ShowError("%s:%d - %s\n", config_error_file(config),
config_error_line(config), config_error_text(config));
libconfig->destroy(config);
- return 1;
+ return CONFIG_FALSE;
}
- return 0;
+ return CONFIG_TRUE;
}
//
@@ -436,7 +438,7 @@ void libconfig_defaults(void) {
libconfig->lookup_bool = config_lookup_bool;
libconfig->lookup_string = config_lookup_string;
/* those are custom and are from src/common/conf.c */
- libconfig->read_file = conf_read_file;
+ libconfig->load_file = config_load_file;
libconfig->setting_copy_simple = config_setting_copy_simple;
libconfig->setting_copy_elem = config_setting_copy_elem;
libconfig->setting_copy_aggregate = config_setting_copy_aggregate;
diff --git a/src/common/conf.h b/src/common/conf.h
index 8bec2704f..3bcb4526f 100644
--- a/src/common/conf.h
+++ b/src/common/conf.h
@@ -100,7 +100,7 @@ struct libconfig_interface {
/* those are custom and are from src/common/conf.c */
/* Functions to copy settings from libconfig/contrib */
- int (*read_file) (config_t *config, const char *config_filename);
+ 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);
diff --git a/src/common/socket.c b/src/common/socket.c
index 740c07bdc..be144fd50 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -1726,7 +1726,7 @@ void socket_net_config_read(const char *filename)
int i;
nullpo_retv(filename);
- if (libconfig->read_file(&network_config, filename)) {
+ if (!libconfig->load_file(&network_config, filename)) {
ShowError("LAN Support configuration file is not found: '%s'. This server won't be able to accept connections from any servers.\n", filename);
return;
}