From 38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 17 Dec 2013 23:02:13 -0200 Subject: 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 --- src/common/ers.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/common/ers.c') diff --git a/src/common/ers.c b/src/common/ers.c index 22269a51f..a7dad49ab 100644 --- a/src/common/ers.c +++ b/src/common/ers.c @@ -40,6 +40,7 @@ * @see common#ers.h * \*****************************************************************************/ #include +#include #include "../common/cbasetypes.h" #include "../common/malloc.h" // CREATE, RECREATE, aMalloc, aFree @@ -238,6 +239,9 @@ static void ers_obj_free_entry(ERS self, void *entry) return; } + if( instance->Options & ERS_OPT_CLEAN ) + memset((unsigned char*)reuse + sizeof(struct ers_list), 0, instance->Cache->ObjectSize - sizeof(struct ers_list)); + reuse->Next = instance->Cache->ReuseList; instance->Cache->ReuseList = reuse; instance->Count--; -- cgit v1.2.3-60-g2f50