summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-08-11 02:17:37 +0200
committerHaru <haru@dotalux.com>2015-08-15 00:51:45 +0200
commite7c2f7d827ad286dc826e483391e64b8ffe2720b (patch)
tree16cab3d257a795c015dfd55c0eaf2447d0f52462 /src/common
parent5efc9f173f6905da39f3037c278e0e880e82ca35 (diff)
downloadhercules-e7c2f7d827ad286dc826e483391e64b8ffe2720b.tar.gz
hercules-e7c2f7d827ad286dc826e483391e64b8ffe2720b.tar.bz2
hercules-e7c2f7d827ad286dc826e483391e64b8ffe2720b.tar.xz
hercules-e7c2f7d827ad286dc826e483391e64b8ffe2720b.zip
Automatic HPM symbol sharing
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/HPM.c38
-rw-r--r--src/common/HPM.h2
-rw-r--r--src/common/HPMi.h4
3 files changed, 3 insertions, 41 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index dcca6ae4c..a78f03daa 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -533,9 +533,6 @@ void hplugins_config_read(void) {
if (libconfig->read_file(&plugins_conf, config_filename))
return;
- if( HPM->symbol_defaults_sub )
- HPM->symbol_defaults_sub();
-
plist = libconfig->lookup(&plugins_conf, "plugins_list");
for (i = 0; i < HPM->cmdline_plugins_count; i++) {
config_setting_t *entry = libconfig->setting_add(plist, NULL, CONFIG_TYPE_STRING);
@@ -748,37 +745,6 @@ void HPM_datacheck_final(void) {
db_destroy(datacheck_db);
}
-void hplugins_share_defaults(void) {
- /* core */
- HPM->share(core,"core");
- HPM->share(HPMiMalloc, "iMalloc");
- HPM->share(cmdline,"cmdline");
- /* console */
- HPM->share(console,"console");
- /* db */
- HPM->share(DB, "DB");
- /* nullpo */
- HPM->share(nullpo,"nullpo");
- /* showmsg */
- HPM->share(showmsg,"showmsg");
- /* socket */
- HPM->share(sockt,"sockt");
- /* strlib */
- HPM->share(strlib,"strlib");
- HPM->share(sv,"sv");
- HPM->share(StrBuf,"StrBuf");
- /* sql */
- HPM->share(SQL,"SQL");
- /* timer */
- HPM->share(timer,"timer");
- /* libconfig */
- HPM->share(libconfig,"libconfig");
- /* sysinfo */
- HPM->share(sysinfo,"sysinfo");
- /* utils */
- HPM->share(HCache,"HCache");
-}
-
void hpm_init(void) {
unsigned int i;
datacheck_db = NULL;
@@ -810,8 +776,6 @@ void hpm_init(void) {
HPM->packetsc[i] = 0;
}
- HPM->symbol_defaults();
-
#ifdef CONSOLE_INPUT
console->input->addCommand("plugins",CPCMD_A(plugins));
#endif
@@ -906,9 +870,7 @@ void hpm_defaults(void) {
HPM->iscompatible = hplugin_iscompatible;
HPM->import_symbol = hplugin_import_symbol;
HPM->share = hplugin_export_symbol;
- HPM->symbol_defaults = hplugins_share_defaults;
HPM->config_read = hplugins_config_read;
- HPM->symbol_defaults_sub = NULL;
HPM->pid2name = hplugins_id2name;
HPM->parse_packets = hplugins_parse_packets;
HPM->load_sub = NULL;
diff --git a/src/common/HPM.h b/src/common/HPM.h
index 2d38a2bfa..c13132cfc 100644
--- a/src/common/HPM.h
+++ b/src/common/HPM.h
@@ -129,9 +129,7 @@ struct HPM_interface {
void (*event) (enum hp_event_types type);
void *(*import_symbol) (char *name, unsigned int pID);
void (*share) (void *, char *);
- void (*symbol_defaults) (void);
void (*config_read) (void);
- void (*symbol_defaults_sub) (void);//TODO drop
char *(*pid2name) (unsigned int pid);
unsigned char (*parse_packets) (int fd, enum HPluginPacketHookingPoints point);
void (*load_sub) (struct hplugin *plugin);
diff --git a/src/common/HPMi.h b/src/common/HPMi.h
index 6f97659f9..bd8d8fe64 100644
--- a/src/common/HPMi.h
+++ b/src/common/HPMi.h
@@ -218,7 +218,9 @@ struct HPMi_interface {
Sql *sql_handle;
};
-#ifndef HERCULES_CORE
+#ifdef HERCULES_CORE
+#define HPM_SYMBOL(n, s) (HPM->share((s), (n)), true)
+#else // ! HERCULES_CORE
HPExport struct HPMi_interface HPMi_s;
HPExport struct HPMi_interface *HPMi;
HPExport void *(*import_symbol) (char *name, unsigned int pID);