diff options
author | zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-11-19 15:28:29 +0000 |
---|---|---|
committer | zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-11-19 15:28:29 +0000 |
commit | 36199bc966081179ec228c7073d46aa619e9d918 (patch) | |
tree | 9e212146f1bc39328c5d669afd6964f1b8083d2e | |
parent | cefbe26acfca0ede20a41f1c381176d6f2b5b8a0 (diff) | |
download | pcre-36199bc966081179ec228c7073d46aa619e9d918.tar.gz |
JIT should use pcre_malloc/pcre_free for allocation.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@752 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | pcre_jit_compile.c | 2 | ||||
-rw-r--r-- | sljit/sljitConfigInternal.h | 22 | ||||
-rw-r--r-- | sljit/sljitLir.c | 3 |
4 files changed, 23 insertions, 6 deletions
@@ -44,6 +44,8 @@ Version 8.21 10. Add a cast and remove a redundant test from the code. +11. JIT should use pcre_malloc/pcre_free for allocation. + Version 8.20 21-Oct-2011 ------------------------ diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c index 9060ff9..3f8259d 100644 --- a/pcre_jit_compile.c +++ b/pcre_jit_compile.c @@ -52,6 +52,8 @@ POSSIBILITY OF SUCH DAMAGE. we just include it. This way we don't need to touch the build system files. */ +#define SLJIT_MALLOC(size) (pcre_malloc)(size) +#define SLJIT_FREE(ptr) (pcre_free)(ptr) #define SLJIT_CONFIG_AUTO 1 #define SLJIT_CONFIG_STATIC 1 #define SLJIT_VERBOSE 0 diff --git a/sljit/sljitConfigInternal.h b/sljit/sljitConfigInternal.h index 207dc18..b0750d3 100644 --- a/sljit/sljitConfigInternal.h +++ b/sljit/sljitConfigInternal.h @@ -119,21 +119,33 @@ #if !(defined SLJIT_STD_MACROS_DEFINED && SLJIT_STD_MACROS_DEFINED) +/* These libraries are needed for the macros below. */ #include <stdlib.h> #include <string.h> -/* General libraries: +#endif /* STD_MACROS_DEFINED */ + +/* General macros: Note: SLJIT is designed to be independent from them as possible. - In release mode (SLJIT_DEBUG is not defined) only the following macros are needed: */ + In release mode (SLJIT_DEBUG is not defined) only the following macros are needed: +*/ -/* General allocation. */ +#ifndef SLJIT_MALLOC #define SLJIT_MALLOC(size) malloc(size) -#define SLJIT_MALLOC_ZEROED(size) calloc((size), 1) +#endif + +#ifndef SLJIT_FREE #define SLJIT_FREE(ptr) free(ptr) +#endif + +#ifndef SLJIT_MEMMOVE #define SLJIT_MEMMOVE(dest, src, len) memmove(dest, src, len) +#endif -#endif /* STD_MACROS_DEFINED */ +#ifndef SLJIT_ZEROMEM +#define SLJIT_ZEROMEM(dest, len) memset(dest, 0, len) +#endif #if !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY) diff --git a/sljit/sljitLir.c b/sljit/sljitLir.c index 592aa0e..59cbe4b 100644 --- a/sljit/sljitLir.c +++ b/sljit/sljitLir.c @@ -195,9 +195,10 @@ static void init_compiler(void); SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void) { - struct sljit_compiler *compiler = (struct sljit_compiler*)SLJIT_MALLOC_ZEROED(sizeof(struct sljit_compiler)); + struct sljit_compiler *compiler = (struct sljit_compiler*)SLJIT_MALLOC(sizeof(struct sljit_compiler)); if (!compiler) return NULL; + SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler)); SLJIT_COMPILE_ASSERT( sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1 |