summaryrefslogtreecommitdiff
path: root/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
diff options
context:
space:
mode:
authorSmokexyz <sagunxp@gmail.com>2015-08-29 15:04:04 +0530
committerSmokexyz <sagunxp@gmail.com>2015-10-02 00:42:13 +0530
commit993138361b5d712afbd7afee6aba5d5c52bdcc4f (patch)
treed5572d3a5291044e7f890c8f7b9b160c5a1d733f /src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
parentf7a97b556e05373711998d4f819cf7d89e4b0ce8 (diff)
downloadhercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.tar.gz
hercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.tar.bz2
hercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.tar.xz
hercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.zip
Convert refine_db.txt to refine_db.conf (libconfig)
Thanks for Haru and 4414 for pointing out inefficiency in code, edited as suggested. Rework - Changed refine_db.conf format to a more concise one, thanks to Haru for suggesting. [2/10/15] Updated with corrections pointed out by Haru. Updated warning and error messages.
Diffstat (limited to 'src/plugins/HPMHooking/HPMHooking_map.Hooks.inc')
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc53
1 files changed, 40 insertions, 13 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index e6aad6dad..2454846f8 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -72994,15 +72994,15 @@ bool HP_status_readdb_sizefix(char *fields[], int columns, int current) {
}
return retVal___;
}
-bool HP_status_readdb_refine(char *fields[], int columns, int current) {
+int HP_status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, const char *source) {
int hIndex = 0;
- bool retVal___ = false;
- if( HPMHooks.count.HP_status_readdb_refine_pre ) {
- bool (*preHookFunc) (char *fields[], int *columns, int *current);
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre ) {
+ int (*preHookFunc) (config_setting_t *r, const char *name, const char *source);
*HPMforce_return = false;
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_pre; hIndex++ ) {
- preHookFunc = HPMHooks.list.HP_status_readdb_refine_pre[hIndex].func;
- retVal___ = preHookFunc(fields, &columns, &current);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(r, name, source);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -73010,13 +73010,40 @@ bool HP_status_readdb_refine(char *fields[], int columns, int current) {
}
}
{
- retVal___ = HPMHooks.source.status.readdb_refine(fields, columns, current);
+ retVal___ = HPMHooks.source.status.readdb_refine_libconfig_sub(r, name, source);
}
- if( HPMHooks.count.HP_status_readdb_refine_post ) {
- bool (*postHookFunc) (bool retVal___, char *fields[], int *columns, int *current);
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_post; hIndex++ ) {
- postHookFunc = HPMHooks.list.HP_status_readdb_refine_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, fields, &columns, &current);
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post ) {
+ int (*postHookFunc) (int retVal___, config_setting_t *r, const char *name, const char *source);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, r, name, source);
+ }
+ }
+ return retVal___;
+}
+int HP_status_readdb_refine_libconfig(const char *filename) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_pre ) {
+ int (*preHookFunc) (const char *filename);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_pre[hIndex].func;
+ retVal___ = preHookFunc(filename);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.status.readdb_refine_libconfig(filename);
+ }
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_post ) {
+ int (*postHookFunc) (int retVal___, const char *filename);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename);
}
}
return retVal___;