Revision: 752
http://vcs.pcre.org/viewvc?view=rev&revision=752
Author: zherczeg
Date: 2011-11-19 15:28:29 +0000 (Sat, 19 Nov 2011)
Log Message:
-----------
JIT should use pcre_malloc/pcre_free for allocation.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_jit_compile.c
code/trunk/sljit/sljitConfigInternal.h
code/trunk/sljit/sljitLir.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2011-11-18 11:13:30 UTC (rev 751)
+++ code/trunk/ChangeLog 2011-11-19 15:28:29 UTC (rev 752)
@@ -44,7 +44,9 @@
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
------------------------
Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c 2011-11-18 11:13:30 UTC (rev 751)
+++ code/trunk/pcre_jit_compile.c 2011-11-19 15:28:29 UTC (rev 752)
@@ -52,6 +52,8 @@
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
Modified: code/trunk/sljit/sljitConfigInternal.h
===================================================================
--- code/trunk/sljit/sljitConfigInternal.h 2011-11-18 11:13:30 UTC (rev 751)
+++ code/trunk/sljit/sljitConfigInternal.h 2011-11-19 15:28:29 UTC (rev 752)
@@ -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)
Modified: code/trunk/sljit/sljitLir.c
===================================================================
--- code/trunk/sljit/sljitLir.c 2011-11-18 11:13:30 UTC (rev 751)
+++ code/trunk/sljit/sljitLir.c 2011-11-19 15:28:29 UTC (rev 752)
@@ -195,9 +195,10 @@
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