diff options
author | shennetsind <ind@henn.et> | 2013-12-17 23:02:13 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-12-17 23:02:13 -0200 |
commit | 38f6b2c68c59d3ed2e3fc6d4d75907939c4fdf61 (patch) | |
tree | 45b4bf49bca0ffb5fabe7405f445caa22cc215f8 /src/common/malloc.h | |
parent | 46a990697bdacaf3955c54e0b9d8503f3b704728 (diff) | |
download | hercules-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/malloc.h')
-rw-r--r-- | src/common/malloc.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/malloc.h b/src/common/malloc.h index cd0ef238b..19b5213bb 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -33,6 +33,7 @@ # define aMalloc(n) (iMalloc->malloc((n),ALC_MARK)) # define aCalloc(m,n) (iMalloc->calloc((m),(n),ALC_MARK)) # define aRealloc(p,n) (iMalloc->realloc((p),(n),ALC_MARK)) +# define aReallocz(p,n) (iMalloc->reallocz((p),(n),ALC_MARK)) # define aStrdup(p) (iMalloc->astrdup((p),ALC_MARK)) # define aFree(p) (iMalloc->free((p),ALC_MARK)) @@ -54,7 +55,7 @@ ////////////// Others ////////////////////////// // should be merged with any of above later #define CREATE(result, type, number) ((result) = (type *) aCalloc((number), sizeof(type))) -#define RECREATE(result, type, number) ((result) = (type *) aRealloc((result), sizeof(type) * (number))) +#define RECREATE(result, type, number) ((result) = (type *) aReallocz((result), sizeof(type) * (number))) //////////////////////////////////////////////// @@ -73,6 +74,7 @@ struct malloc_interface { void* (*malloc )(size_t size, const char *file, int line, const char *func); void* (*calloc )(size_t num, size_t size, const char *file, int line, const char *func); void* (*realloc )(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); char* (*astrdup )(const char *p, const char *file, int line, const char *func); void (*free )(void *p, const char *file, int line, const char *func); /* */ |