summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2010-03-03 12:01:00 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2010-03-03 12:01:00 +0000
commitd3ebf28a7ff375fe7681717ef4b0056138564e39 (patch)
tree2a8e48f40cc31405abee86296a916df9e07fef51
parent7b3e9efea8a44394eb40c2b5e98c1b5e1251bac6 (diff)
downloadpcre-d3ebf28a7ff375fe7681717ef4b0056138564e39.tar.gz
Use local function indirection for pcre_malloc etc. for Visual Studio and
Symbian. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@497 2f5784b3-3f2a-0410-8824-cb99058d5e15
-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;