From f2f78491bc610222b437dc1912ed4ab18db55da8 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Fri, 29 Sep 2006 18:57:07 +0200 Subject: [PATCH] Re: [PATCH] Add hook for re_dup() into regex engine as reg_dupe (make re pluggable under threads) Message-ID: <9b18b3110609290757n62b3484i7bb948f965524191@mail.gmail.com> p4raw-id: //depot/perl@28902 --- perl.h | 12 +++++++----- regcomp.c | 2 +- regexp.h | 18 +++++++++--------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/perl.h b/perl.h index bc0b192..ac26b38 100644 --- a/perl.h +++ b/perl.h @@ -198,19 +198,21 @@ #define CALLREGCOMP(exp, xend, pm) Perl_pregcomp(aTHX_ exp,xend,pm) +#define CALLREGCOMP_ENG(prog, exp, xend, pm) \ + CALL_FPTR(((prog)->comp))(aTHX_ exp, xend, pm) #define CALLREGEXEC(prog,stringarg,strend,strbeg,minend,screamer,data,flags) \ - CALL_FPTR((prog)->engine->regexec)(aTHX_ (prog),(stringarg),(strend), \ + CALL_FPTR((prog)->engine->exec)(aTHX_ (prog),(stringarg),(strend), \ (strbeg),(minend),(screamer),(data),(flags)) #define CALLREG_INTUIT_START(prog,sv,strpos,strend,flags,data) \ - CALL_FPTR((prog)->engine->re_intuit_start)(aTHX_ (prog), (sv), (strpos), \ + CALL_FPTR((prog)->engine->intuit)(aTHX_ (prog), (sv), (strpos), \ (strend),(flags),(data)) #define CALLREG_INTUIT_STRING(prog) \ - CALL_FPTR((prog)->engine->re_intuit_string)(aTHX_ (prog)) + CALL_FPTR((prog)->engine->checkstr)(aTHX_ (prog)) #define CALLREGFREE(prog) \ - if(prog) CALL_FPTR((prog)->engine->regfree)(aTHX_ (prog)) + if(prog) CALL_FPTR((prog)->engine->free)(aTHX_ (prog)) #if defined(USE_ITHREADS) #define CALLREGDUPE(prog,param) \ - (prog ? CALL_FPTR((prog)->engine->regdupe)(aTHX_ (prog),(param)) \ + (prog ? CALL_FPTR((prog)->engine->dupe)(aTHX_ (prog),(param)) \ : (REGEXP *)NULL) #endif diff --git a/regcomp.c b/regcomp.c index 063549e..9f92af8 100644 --- a/regcomp.c +++ b/regcomp.c @@ -3713,7 +3713,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm) PerlIO_printf(Perl_debug_log, "Using engine %"UVxf"\n", SvIV(*ptr)); }); - return CALL_FPTR((eng->regcomp))(aTHX_ exp, xend, pm); + return CALLREGCOMP_ENG(eng, exp, xend, pm); } }) register regexp *r; diff --git a/regexp.h b/regexp.h index 09759fa..99973c1 100644 --- a/regexp.h +++ b/regexp.h @@ -66,17 +66,17 @@ typedef struct re_scream_pos_data_s } re_scream_pos_data; typedef struct regexp_engine { - regexp* (*regcomp) (pTHX_ char* exp, char* xend, PMOP* pm); - I32 (*regexec) (pTHX_ regexp* prog, char* stringarg, char* strend, + regexp* (*comp) (pTHX_ char* exp, char* xend, PMOP* pm); + I32 (*exec) (pTHX_ regexp* prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, void* data, U32 flags); - char* (*re_intuit_start) (pTHX_ regexp *prog, SV *sv, char *strpos, - char *strend, U32 flags, - struct re_scream_pos_data_s *data); - SV* (*re_intuit_string) (pTHX_ regexp *prog); - void (*regfree) (pTHX_ struct regexp* r); -#if defined(USE_ITHREADS) - regexp* (*regdupe) (pTHX_ const regexp *r, CLONE_PARAMS *param); + char* (*intuit) (pTHX_ regexp *prog, SV *sv, char *strpos, + char *strend, U32 flags, + struct re_scream_pos_data_s *data); + SV* (*checkstr) (pTHX_ regexp *prog); + void (*free) (pTHX_ struct regexp* r); +#ifdef USE_ITHREADS + regexp* (*dupe) (pTHX_ const regexp *r, CLONE_PARAMS *param); #endif } regexp_engine; -- 2.7.4