Autor: Philip Hazel Data: Dla: Sheri CC: pcre-dev Temat: Re: [pcre-dev] A test for the memory mismatch problem
On Thu, 29 Mar 2007, Sheri wrote:
> Hey Philip, I see some other notes in the old NON-UNIX USE (haven't
> looked at the new one yet) about missing function pointers for malloc
> and free.
>
> Should we try adding this bit to pcre.h or pcretest.c?
>
> =========================
> #ifdef _WIN32
> #include <malloc.h>
>
> void* malloc_stub(size_t N)
> { return malloc(N); }
> void free_stub(void* p)
> { free(p); }
> void *(*pcre_malloc)(size_t) = &malloc_stub;
> void (*pcre_free)(void *) = &free_stub;
>
> #else
>
> void *(*pcre_malloc)(size_t) = malloc;
> void (*pcre_free)(void *) = free;
>
> #endif
> =========================
Yes, that has the right kind of smell about it! But it needs to go right
at the bottom of pcre_globals.c, replacing the two definitions that are
there.
Aha! I see that callout is there too, and I seem to remember you had
callout problems. Perhaps worth trying replacing all 5 of the functions
you'll find there in the manner suggested above.
Philip
--
Philip Hazel, University of Cambridge Computing Service.