[pcre-dev] Patch for NO_RECURSE and Visual Studio Build

Góra strony
Delete this message
Autor: CrystalP
Data:  
Dla: pcre-dev
Temat: [pcre-dev] Patch for NO_RECURSE and Visual Studio Build
Hello,

I'm a dev of the XBMC project (see http://xbmc.org/). We use libpcre in
the media scrapers, to process the html returned by sites such as
imdb.com and extract fields like the movie title, year, plot, etc.

We decided to define NO_RECURSE and had to add a couple casts to build
pcre under Visual Studio.
You will find attached the patch. Please consider merging it in the
official source code.

Regards,

Pierre

diff --git a/pcre_exec.c b/pcre_exec.c
index 8029bef..eee2642 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -294,7 +294,7 @@ argument of match(), which never changes. */

#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\
{\
- heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
+ heapframe *newframe = (heapframe*)(pcre_stack_malloc)(sizeof(heapframe));\
if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\
frame->Xwhere = rw; \
newframe->Xeptr = ra;\
@@ -488,7 +488,7 @@ heap storage. Set up the top-level frame here; others are obtained from the
heap whenever RMATCH() does a "recursion". See the macro definitions above. */

 #ifdef NO_RECURSE
-heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe));
+heapframe *frame = (heapframe*)(pcre_stack_malloc)(sizeof(heapframe));
 if (frame == NULL) RRETURN(PCRE_ERROR_NOMEMORY);
 frame->Xprevframe = NULL;            /* Marks the top level */