summaryrefslogtreecommitdiff
path: root/sljit
diff options
context:
space:
mode:
Diffstat (limited to 'sljit')
-rw-r--r--sljit/sljitConfigInternal.h22
-rw-r--r--sljit/sljitLir.c3
2 files changed, 19 insertions, 6 deletions
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