summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--pcre_globals.c27
2 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1199be2..2cff5c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,11 @@ Version 8.02 01-Mar-2010
quantifier applied to a forward-referencing subroutine call, could compile
incorrect code or give the error "internal error: previously-checked
referenced subpattern not found".
+
+6. Both MS Visual Studio and Symbian OS have problems with initializing
+ variables to point to external functions. For these systems, therefore,
+ pcre_malloc etc. are now initialized to local functions that call the
+ relevant global functions.
Version 8.01 19-Jan-2010
diff --git a/pcre_globals.c b/pcre_globals.c
index 24ed03d..10d0b2b 100644
--- a/pcre_globals.c
+++ b/pcre_globals.c
@@ -43,8 +43,14 @@ PCRE is thread-clean and doesn't use any global variables in the normal sense.
However, it calls memory allocation and freeing functions via the four
indirections below, and it can optionally do callouts, using the fifth
indirection. These values can be changed by the caller, but are shared between
-all threads. However, when compiling for Virtual Pascal, things are done
-differently, and global variables are not used (see pcre.in). */
+all threads.
+
+For MS Visual Studio and Symbian OS, there are problems in initializing these
+variables to non-local functions. In these cases, therefore, an indirection via
+a local function is used.
+
+Also, when compiling for Virtual Pascal, things are done differently, and
+global variables are not used. */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -52,7 +58,22 @@ differently, and global variables are not used (see pcre.in). */
#include "pcre_internal.h"
-#ifndef VPCOMPAT
+#if defined _MSC_VER || defined __SYMBIAN32__
+static void* LocalPcreMalloc(size_t aSize)
+ {
+ return malloc(aSize);
+ }
+static void LocalPcreFree(void* aPtr)
+ {
+ free(aPtr);
+ }
+PCRE_EXP_DATA_DEFN void *(*pcre_malloc)(size_t) = LocalPcreMalloc;
+PCRE_EXP_DATA_DEFN void (*pcre_free)(void *) = LocalPcreFree;
+PCRE_EXP_DATA_DEFN void *(*pcre_stack_malloc)(size_t) = LocalPcreMalloc;
+PCRE_EXP_DATA_DEFN void (*pcre_stack_free)(void *) = LocalPcreFree;
+PCRE_EXP_DATA_DEFN int (*pcre_callout)(pcre_callout_block *) = NULL;
+
+#elif !defined VPCOMPAT
PCRE_EXP_DATA_DEFN void *(*pcre_malloc)(size_t) = malloc;
PCRE_EXP_DATA_DEFN void (*pcre_free)(void *) = free;
PCRE_EXP_DATA_DEFN void *(*pcre_stack_malloc)(size_t) = malloc;