summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-17 01:21:28 +0200
committerHaru <haru@dotalux.com>2015-10-11 00:24:22 +0200
commit70265291d62280c525adc317158e9f531e0147ff (patch)
tree8beae9d0edc99a38bc678b86f2709780314ad327 /src/login
parent502703d2b632125b35a2b8d341a90a13d7445f02 (diff)
downloadhercules-70265291d62280c525adc317158e9f531e0147ff.tar.gz
hercules-70265291d62280c525adc317158e9f531e0147ff.tar.bz2
hercules-70265291d62280c525adc317158e9f531e0147ff.tar.xz
hercules-70265291d62280c525adc317158e9f531e0147ff.zip
Cleanup of the HPluginData implementation (First part)
- Several explicit casts are removed, to have a slightly better type-checking at compile time. - A destructor function is provided, to remove code duplication. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/login')
-rw-r--r--src/login/HPMlogin.c17
-rw-r--r--src/login/HPMlogin.h2
2 files changed, 13 insertions, 6 deletions
diff --git a/src/login/HPMlogin.c b/src/login/HPMlogin.c
index 895cbad16..ce88728fe 100644
--- a/src/login/HPMlogin.c
+++ b/src/login/HPMlogin.c
@@ -32,13 +32,18 @@
// HPMDataCheck comes after all the other includes
#include "common/HPMDataCheck.h"
-bool HPM_login_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr) {
- /* record address */
- switch( type ) {
+/**
+ * HPM plugin data store validator sub-handler (login-server)
+ *
+ * @see HPM_interface::data_store_validate
+ */
+bool HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **store)
+{
+ switch (type) {
default:
- return false;
+ break;
}
- return true;
+ return false;
}
void HPM_login_plugin_load_sub(struct hplugin *plugin) {
@@ -46,6 +51,8 @@ void HPM_login_plugin_load_sub(struct hplugin *plugin) {
}
void HPM_login_do_init(void) {
+ HPM->load_sub = HPM_login_plugin_load_sub;
+ HPM->data_store_validate_sub = HPM_login_data_store_validate;
HPM->datacheck_init(HPMDataCheck, HPMDataCheckLen, HPMDataCheckVer);
HPM_shared_symbols(SERVER_TYPE_LOGIN);
}
diff --git a/src/login/HPMlogin.h b/src/login/HPMlogin.h
index 2a4d5c538..1f08a8666 100644
--- a/src/login/HPMlogin.h
+++ b/src/login/HPMlogin.h
@@ -13,7 +13,7 @@
struct hplugin;
-bool HPM_login_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr);
+bool HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **store);
void HPM_login_plugin_load_sub(struct hplugin *plugin);