summaryrefslogtreecommitdiff
path: root/src/common/HPM.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-12-17 23:02:13 -0200
committershennetsind <ind@henn.et>2013-12-17 23:02:13 -0200
commit38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61 (patch)
tree45b4bf49bca0ffb5fabe7405f445caa22cc215f8 /src/common/HPM.c
parent46a990697bdacaf3955c54e0b9d8503f3b704728 (diff)
downloadhercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.gz
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.bz2
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.tar.xz
hercules-38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61.zip
Speed up of several procedures that rely on ERS, _mreallocz ('z'ero)
Made Possible Thanks to the Woonderful Haruna! <3 Commit also fixes an inconsistency in the ERS, where it'd start with clear memory but would use garbage upon resizing, also implements a new ERS option that clears entries as soon as pass by ers_free, so that they'll be all shinny for when ers_alloc reuses them. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common/HPM.c')
-rw-r--r--src/common/HPM.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index 8e41e5838..426fac94a 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -533,6 +533,9 @@ void* HPM_calloc(size_t num, size_t size, const char *file, int line, const char
void* HPM_realloc(void *p, size_t size, const char *file, int line, const char *func) {
return iMalloc->realloc(p,size,HPM_file2ptr(file),line,func);
}
+void* HPM_reallocz(void *p, size_t size, const char *file, int line, const char *func) {
+ return iMalloc->reallocz(p,size,HPM_file2ptr(file),line,func);
+}
char* HPM_astrdup(const char *p, const char *file, int line, const char *func) {
return iMalloc->astrdup(p,HPM_file2ptr(file),line,func);
}
@@ -705,6 +708,7 @@ void hpm_init(void) {
HPMiMalloc->malloc = HPM_mmalloc;
HPMiMalloc->calloc = HPM_calloc;
HPMiMalloc->realloc = HPM_realloc;
+ HPMiMalloc->reallocz = HPM_reallocz;
HPMiMalloc->astrdup = HPM_astrdup;
sscanf(HPM_VERSION, "%u.%u", &HPM->version[0], &HPM->version[1]);