From: Ævar Arnfjörð Bjarmason Date: Fri, 27 Apr 2007 02:22:25 +0000 (+0000) Subject: Re: [PATCH] Cleanup of the regexp API X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=49d7dfbcef7527d25e8c34643f831ef2416923a3;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] Cleanup of the regexp API From: "Ævar Arnfjörð Bjarmason" Message-ID: <51dd1af80704261922j3db0615wa86ccc4cb65b2713@mail.gmail.com> p4raw-id: //depot/perl@31106 --- diff --git a/embed.fnc b/embed.fnc index cca2880..e92a477 100644 --- a/embed.fnc +++ b/embed.fnc @@ -673,7 +673,7 @@ Amb |OP* |ref |NULLOK OP* o|I32 type p |OP* |refkids |NULLOK OP* o|I32 type Ap |void |regdump |NN const regexp* r Ap |SV* |regclass_swash |NULLOK const regexp *prog|NN const struct regnode *n|bool doinit|NULLOK SV **listsvp|NULLOK SV **altsvp -Ap |I32 |pregexec |NN regexp* prog|NN char* stringarg \ +Ap |I32 |pregexec |NN REGEXP * const prog|NN char* stringarg \ |NN char* strend|NN char* strbeg|I32 minend \ |NN SV* screamer|U32 nosave Ap |void |pregfree |NULLOK struct regexp* r @@ -681,22 +681,22 @@ EXp |struct regexp* |reg_temp_copy |NN struct regexp* r Ap |void |regfree_internal|NULLOK struct regexp* r Ap |char * |reg_stringify |NN MAGIC *mg|NULLOK STRLEN *lp|NULLOK U32 *flags|NULLOK I32 *haseval #if defined(USE_ITHREADS) -Ap |void* |regdupe_internal|NN const regexp* r|NN CLONE_PARAMS* param +Ap |void* |regdupe_internal|NN REGEXP * const r|NN CLONE_PARAMS* param #endif Ap |REGEXP*|pregcomp |NN const SV * const pattern|const U32 flags Ap |REGEXP*|re_compile |NN const SV * const pattern|const U32 flags -Ap |char* |re_intuit_start|NN regexp* prog|NULLOK SV* sv|NN char* strpos \ - |NN char* strend|U32 flags \ +Ap |char* |re_intuit_start|NN REGEXP * const rx|NULLOK SV* sv|NN char* strpos \ + |NN char* strend|const U32 flags \ |NULLOK struct re_scream_pos_data_s *data -Ap |SV* |re_intuit_string|NN regexp* prog -Ap |I32 |regexec_flags |NN regexp* prog|NN char* stringarg \ +Ap |SV* |re_intuit_string|NN REGEXP * const rx +Ap |I32 |regexec_flags |NN REGEXP * const rx|NN char* stringarg \ |NN char* strend|NN char* strbeg|I32 minend \ |NN SV* screamer|NULLOK void* data|U32 flags ApR |regnode*|regnext |NN regnode* p -EXp |SV*|reg_named_buff_get |NN const REGEXP * const rx|NN SV* namesv|U32 flags -EXp |SV*|reg_numbered_buff_get|NN const REGEXP * const rx|I32 paren|NULLOK SV* usesv -EXp |SV*|reg_qr_pkg|NN const REGEXP * const rx +EXp |SV*|reg_named_buff_get |NN REGEXP * const rx|NN SV * const namesv|const U32 flags +EXp |void|reg_numbered_buff_get|NN REGEXP * const rx|const I32 paren|NULLOK SV * const usesv +EXp |SV*|reg_qr_package|NN REGEXP * const rx Ep |void |regprop |NULLOK const regexp *prog|NN SV* sv|NN const regnode* o Ap |void |repeatcpy |NN char* to|NN const char* from|I32 len|I32 count diff --git a/embed.h b/embed.h index 9cbb11c4..8a14bd6 100644 --- a/embed.h +++ b/embed.h @@ -706,7 +706,7 @@ #if defined(PERL_CORE) || defined(PERL_EXT) #define reg_named_buff_get Perl_reg_named_buff_get #define reg_numbered_buff_get Perl_reg_numbered_buff_get -#define reg_qr_pkg Perl_reg_qr_pkg +#define reg_qr_package Perl_reg_qr_package #endif #if defined(PERL_CORE) || defined(PERL_EXT) #define regprop Perl_regprop @@ -2973,7 +2973,7 @@ #if defined(PERL_CORE) || defined(PERL_EXT) #define reg_named_buff_get(a,b,c) Perl_reg_named_buff_get(aTHX_ a,b,c) #define reg_numbered_buff_get(a,b,c) Perl_reg_numbered_buff_get(aTHX_ a,b,c) -#define reg_qr_pkg(a) Perl_reg_qr_pkg(aTHX_ a) +#define reg_qr_package(a) Perl_reg_qr_package(aTHX_ a) #endif #if defined(PERL_CORE) || defined(PERL_EXT) #define regprop(a,b,c) Perl_regprop(aTHX_ a,b,c) diff --git a/ext/re/re.xs b/ext/re/re.xs index 4ac9e4d..ae491f6 100644 --- a/ext/re/re.xs +++ b/ext/re/re.xs @@ -11,22 +11,24 @@ START_EXTERN_C -extern regexp* my_re_compile (pTHX_ const SV * const pattern, const U32 flags); -extern I32 my_regexec (pTHX_ regexp* prog, char* stringarg, char* strend, +extern REGEXP* my_re_compile (pTHX_ const SV * const pattern, U32 pm_flags); +extern I32 my_regexec (pTHX_ REGEXP * const prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, void* data, U32 flags); -extern char* my_re_intuit_start (pTHX_ regexp *prog, SV *sv, char *strpos, +extern char* my_re_intuit_start (pTHX_ REGEXP * const prog, SV *sv, char *strpos, char *strend, U32 flags, struct re_scream_pos_data_s *data); -extern SV* my_re_intuit_string (pTHX_ regexp *prog); - -extern void my_regfree (pTHX_ struct regexp* r); -extern SV* my_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv); -extern SV* my_reg_named_buff_get(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags); -extern SV* my_reg_qr_pkg(pTHX_ const REGEXP * const rx); +extern SV* my_re_intuit_string (pTHX_ REGEXP * const prog); + +extern void my_regfree (pTHX_ REGEXP * const r); +extern void my_reg_numbered_buff_get(pTHX_ REGEXP * const rx, const I32 paren, + SV * const usesv); +extern SV* my_reg_named_buff_get(pTHX_ REGEXP * const rx, SV * const namesv, + const U32 flags); +extern SV* my_reg_qr_package(pTHX_ REGEXP * const rx); #if defined(USE_ITHREADS) -extern void* my_regdupe (pTHX_ const regexp *r, CLONE_PARAMS *param); +extern void* my_regdupe (pTHX_ REGEXP * const r, CLONE_PARAMS *param); #endif EXTERN_C const struct regexp_engine my_reg_engine; @@ -41,13 +43,13 @@ const struct regexp_engine my_reg_engine = { my_regfree, my_reg_numbered_buff_get, my_reg_named_buff_get, - my_reg_qr_pkg, + my_reg_qr_package, #if defined(USE_ITHREADS) my_regdupe #endif }; -regexp * +REGEXP * get_re_arg( pTHX_ SV *sv, U32 flags, MAGIC **mgp) { MAGIC *mg; if (sv) { @@ -59,7 +61,7 @@ get_re_arg( pTHX_ SV *sv, U32 flags, MAGIC **mgp) { (mg = mg_find(sv, PERL_MAGIC_qr))) /* assign deliberate */ { if (mgp) *mgp = mg; - return (regexp *)mg->mg_obj; + return (REGEXP *)mg->mg_obj; } } if (mgp) *mgp = NULL; @@ -82,7 +84,7 @@ regexp_pattern(sv) PROTOTYPE: $ PREINIT: MAGIC *mg; - regexp *re; + REGEXP *re; PPCODE: { /* @@ -167,7 +169,7 @@ regmust(sv) SV * sv PROTOTYPE: $ PREINIT: - regexp *re; + REGEXP *re; PPCODE: { if ( re = get_re_arg( aTHX_ sv, 0, 0) ) /* assign deliberate */ diff --git a/ext/re/re_top.h b/ext/re/re_top.h index 39e0276..5ac0ac4 100644 --- a/ext/re/re_top.h +++ b/ext/re/re_top.h @@ -18,7 +18,7 @@ #define Perl_regdupe_internal my_regdupe #define Perl_reg_numbered_buff_get my_reg_numbered_buff_get #define Perl_reg_named_buff_get my_reg_named_buff_get -#define Perl_reg_qr_pkg my_reg_qr_pkg +#define Perl_reg_qr_package my_reg_qr_package #define PERL_NO_GET_CONTEXT diff --git a/global.sym b/global.sym index 9ea8c8b..f76482b 100644 --- a/global.sym +++ b/global.sym @@ -407,7 +407,7 @@ Perl_regexec_flags Perl_regnext Perl_reg_named_buff_get Perl_reg_numbered_buff_get -Perl_reg_qr_pkg +Perl_reg_qr_package Perl_repeatcpy Perl_rninstr Perl_rsignal diff --git a/perl.h b/perl.h index 51155f0..54ebb8f 100644 --- a/perl.h +++ b/perl.h @@ -225,8 +225,8 @@ #define CALLREG_NAMEDBUF(rx,name,flags) \ CALL_FPTR((rx)->engine->named_buff_get)(aTHX_ (rx),(name),(flags)) -#define CALLREG_QRPKG(rx) \ - CALL_FPTR((rx)->engine->qr_pkg)(aTHX_ (rx)) +#define CALLREG_PACKAGE(rx) \ + CALL_FPTR((rx)->engine->qr_package)(aTHX_ (rx)) #if defined(USE_ITHREADS) #define CALLREGDUPE(prog,param) \ diff --git a/pod/perlreapi.pod b/pod/perlreapi.pod index ff69bb7..a39eca4 100644 --- a/pod/perlreapi.pod +++ b/pod/perlreapi.pod @@ -10,19 +10,21 @@ structure of the following format: typedef struct regexp_engine { REGEXP* (*comp) (pTHX_ const SV * const pattern, const U32 flags); - I32 (*exec) (pTHX_ regexp* prog, char* stringarg, char* strend, - char* strbeg, I32 minend, SV* screamer, - void* data, U32 flags); - 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); - SV* (*numbered_buff_get) (pTHX_ const REGEXP * const rx, I32 paren, SV* usesv); - SV* (*named_buff_get)(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags); - SV* (*qr_pkg)(pTHX_ const REGEXP * const rx); + I32 (*exec) (pTHX_ REGEXP * const rx, char* stringarg, char* strend, + char* strbeg, I32 minend, SV* screamer, + void* data, U32 flags); + char* (*intuit) (pTHX_ REGEXP * const rx, SV *sv, char *strpos, + char *strend, U32 flags, + struct re_scream_pos_data_s *data); + SV* (*checkstr) (pTHX_ REGEXP * const rx); + void (*free) (pTHX_ REGEXP * const rx); + void (*numbered_buff_get) (pTHX_ REGEXP * const rx, + const I32 paren, SV * const usesv); + SV* (*named_buff_get)(pTHX_ REGEXP * const rx, SV * const namesv, + const U32 flags); + SV* (*qr_package)(pTHX_ REGEXP * const rx); #ifdef USE_ITHREADS - void* (*dupe) (pTHX_ const regexp *r, CLONE_PARAMS *param); + void* (*dupe) (pTHX_ REGEXP * const rx, CLONE_PARAMS *param); #endif } regexp_engine; @@ -129,7 +131,7 @@ by the tokenizer regardless of the engine currently in use. =item RXf_PMf_KEEPCOPY -The C flag. +The C

flag. =item RXf_UTF8 @@ -146,7 +148,7 @@ preserved verbatim in regex->extflags. =head2 exec - I32 exec(regexp* prog, + I32 exec(pTHX_ REGEXP * const rx, char *stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, void* data, U32 flags); @@ -155,9 +157,9 @@ Execute a regexp. =head2 intuit - char* intuit( regexp *prog, + char* intuit(pTHX_ REGEXP * const rx, SV *sv, char *strpos, char *strend, - U32 flags, struct re_scream_pos_data_s *data); + const U32 flags, struct re_scream_pos_data_s *data); Find the start position where a regex match should be attempted, or possibly whether the regex engine should not be run because the @@ -167,14 +169,14 @@ structure. =head2 checkstr - SV* checkstr(regexp *prog); + SV* checkstr(pTHX_ REGEXP * const rx); Return a SV containing a string that must appear in the pattern. Used by C for optimising matches. =head2 free - void free(regexp *prog); + void free(pTHX_ REGEXP * const rx); Called by perl when it is freeing a regexp pattern so that the engine can release any resources pointed to by the C member of the @@ -183,26 +185,49 @@ perl will handle releasing anything else contained in the regexp structure. =head2 numbered_buff_get - SV* numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv); + void numbered_buff_get(pTHX_ REGEXP * const rx, const I32 paren, + SV * const usesv); -TODO: document +Called to get the value of C<$`>, C<$'>, C<$&> (and their named +equivalents, see L) and the numbered capture buffers (C<$1>, +C<$2>, ...). + +The C paramater will be C<-2> for C<$`>, C<-1> for C<$'>, C<0> +for C<$&>, C<1> for C<$1> and so forth. + +C should be set to the scalar to return, the scalar is passed +as an argument rather than being returned from the function because +when it's called perl already has a scalar to store the value, +creating another one would be redundant. The scalar can be set with +C, C and friends, see L. + +This callback is where perl untaints its own capture variables under +taint mode (see L). See the C +function in F for how to untaint capture variables if +that's something you'd like your engine to do as well. =head2 named_buff_get - SV* named_buff_get(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags); + SV* named_buff_get(pTHX_ REGEXP * const rx, SV * const namesv, + const U32 flags); -TODO: document +Called to get the value of key in the C<%+> and C<%-> hashes, +C is the hash key being requested and if C is true +C<%-> is being requested (and C<%+> if it's not). -=head2 qr_pkg +=head2 qr_package - SV* qr_pkg(pTHX_ const REGEXP * const rx); + SV* qr_package(pTHX_ REGEXP * const rx); The package the qr// magic object is blessed into (as seen by C). It is recommended that engines change this to its package -name, for instance: +qr//>). It is recommended that engines change this to their package +name for identification regardless of whether they implement methods +on the object. + +A callback implementation might be: SV* - Example_reg_qr_pkg(pTHX_ const REGEXP * const rx) + Example_reg_qr_package(pTHX_ REGEXP * const rx) { PERL_UNUSED_ARG(rx); return newSVpvs("re::engine::Example"); @@ -241,7 +266,7 @@ Or use the (CURRENTLY UNDOCUMENETED!) C function: =head2 dupe - void* dupe(const regexp *r, CLONE_PARAMS *param); + void* dupe(pTHX_ REGEXP * const rx, CLONE_PARAMS *param); On threaded builds a regexp may need to be duplicated so that the pattern can be used by mutiple threads. This routine is expected to handle the @@ -438,13 +463,6 @@ occur at a floating offset from the start of the pattern. Used to do Fast-Boyer-Moore searches on the string to find out if its worth using the regex engine at all, and if so where in the string to search. -=item C, C - -These fields store arrays that are used to hold the offsets of the begining -and end of each capture group that has matched. -1 is used to indicate no match. - -These are the source for @- and @+. - =item C C C #define SAVEPVN(p,n) ((p) ? savepvn(p,n) : NULL) diff --git a/pp_hot.c b/pp_hot.c index 0fcec7e..7c6e1e3 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1159,7 +1159,7 @@ PP(pp_qr) dVAR; dSP; register PMOP * const pm = cPMOP; REGEXP * rx = PM_GETRE(pm); - SV * const pkg = CALLREG_QRPKG(rx); + SV * const pkg = CALLREG_PACKAGE(rx); SV * const rv = sv_newmortal(); SV * const sv = newSVrv(rv, SvPV_nolen(pkg)); if (rx->extflags & RXf_TAINTED) diff --git a/proto.h b/proto.h index 3e3d979..49bab12 100644 --- a/proto.h +++ b/proto.h @@ -1846,7 +1846,7 @@ PERL_CALLCONV void Perl_regdump(pTHX_ const regexp* r) PERL_CALLCONV SV* Perl_regclass_swash(pTHX_ const regexp *prog, const struct regnode *n, bool doinit, SV **listsvp, SV **altsvp) __attribute__nonnull__(pTHX_2); -PERL_CALLCONV I32 Perl_pregexec(pTHX_ regexp* prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, U32 nosave) +PERL_CALLCONV I32 Perl_pregexec(pTHX_ REGEXP * const prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, U32 nosave) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) @@ -1862,7 +1862,7 @@ PERL_CALLCONV char * Perl_reg_stringify(pTHX_ MAGIC *mg, STRLEN *lp, U32 *flags, __attribute__nonnull__(pTHX_1); #if defined(USE_ITHREADS) -PERL_CALLCONV void* Perl_regdupe_internal(pTHX_ const regexp* r, CLONE_PARAMS* param) +PERL_CALLCONV void* Perl_regdupe_internal(pTHX_ REGEXP * const r, CLONE_PARAMS* param) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -1873,15 +1873,15 @@ PERL_CALLCONV REGEXP* Perl_pregcomp(pTHX_ const SV * const pattern, const U32 fl PERL_CALLCONV REGEXP* Perl_re_compile(pTHX_ const SV * const pattern, const U32 flags) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV char* Perl_re_intuit_start(pTHX_ regexp* prog, SV* sv, char* strpos, char* strend, U32 flags, struct re_scream_pos_data_s *data) +PERL_CALLCONV char* Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV* sv, char* strpos, char* strend, const U32 flags, struct re_scream_pos_data_s *data) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3) __attribute__nonnull__(pTHX_4); -PERL_CALLCONV SV* Perl_re_intuit_string(pTHX_ regexp* prog) +PERL_CALLCONV SV* Perl_re_intuit_string(pTHX_ REGEXP * const rx) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV I32 Perl_regexec_flags(pTHX_ regexp* prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, void* data, U32 flags) +PERL_CALLCONV I32 Perl_regexec_flags(pTHX_ REGEXP * const rx, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, void* data, U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) @@ -1893,14 +1893,14 @@ PERL_CALLCONV regnode* Perl_regnext(pTHX_ regnode* p) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV SV* Perl_reg_named_buff_get(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags) +PERL_CALLCONV SV* Perl_reg_named_buff_get(pTHX_ REGEXP * const rx, SV * const namesv, const U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); -PERL_CALLCONV SV* Perl_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv) +PERL_CALLCONV void Perl_reg_numbered_buff_get(pTHX_ REGEXP * const rx, const I32 paren, SV * const usesv) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV SV* Perl_reg_qr_pkg(pTHX_ const REGEXP * const rx) +PERL_CALLCONV SV* Perl_reg_qr_package(pTHX_ REGEXP * const rx) __attribute__nonnull__(pTHX_1); diff --git a/regcomp.c b/regcomp.c index fcc30bf..35125d9 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4796,7 +4796,7 @@ reStudy: SV* -Perl_reg_named_buff_get(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags) +Perl_reg_named_buff_get(pTHX_ REGEXP * const rx, SV * const namesv, const U32 flags) { AV *retarray = NULL; SV *ret; @@ -4814,7 +4814,8 @@ Perl_reg_named_buff_get(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags) && rx->offs[nums[i]].start != -1 && rx->offs[nums[i]].end != -1) { - ret = CALLREG_NUMBUF(rx,nums[i],NULL); + ret = newSVpvs(""); + CALLREG_NUMBUF(rx,nums[i],ret); if (!retarray) return ret; } else { @@ -4832,17 +4833,16 @@ Perl_reg_named_buff_get(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags) return NULL; } -SV* -Perl_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv) +void +Perl_reg_numbered_buff_get(pTHX_ REGEXP * const rx, const I32 paren, SV * const sv) { char *s = NULL; I32 i = 0; I32 s1, t1; - SV *sv = usesv ? usesv : newSVpvs(""); if (!rx->subbeg) { sv_setsv(sv,&PL_sv_undef); - return sv; + return; } else if (paren == -2 && rx->offs[0].start != -1) { @@ -4866,7 +4866,7 @@ Perl_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv) s = rx->subbeg + s1; } else { sv_setsv(sv,&PL_sv_undef); - return sv; + return; } assert(rx->sublen >= (s - rx->subbeg) + i ); if (i >= 0) { @@ -4904,12 +4904,12 @@ Perl_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv) } } else { sv_setsv(sv,&PL_sv_undef); + return; } - return sv; } SV* -Perl_reg_qr_pkg(pTHX_ const REGEXP * const rx) +Perl_reg_qr_package(pTHX_ REGEXP * const rx) { PERL_UNUSED_ARG(rx); return newSVpvs("Regexp"); @@ -8750,7 +8750,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) } SV * -Perl_re_intuit_string(pTHX_ regexp *prog) +Perl_re_intuit_string(pTHX_ REGEXP * const prog) { /* Assume that RE_INTUIT is set */ dVAR; GET_RE_DEBUG_FLAGS_DECL; @@ -9117,7 +9117,7 @@ Perl_re_dup(pTHX_ const regexp *r, CLONE_PARAMS *param) */ void * -Perl_regdupe_internal(pTHX_ const regexp *r, CLONE_PARAMS *param) +Perl_regdupe_internal(pTHX_ REGEXP * const r, CLONE_PARAMS *param) { dVAR; regexp_internal *reti; diff --git a/regcomp.h b/regcomp.h index 70fdeb5..3e3f223 100644 --- a/regcomp.h +++ b/regcomp.h @@ -471,7 +471,7 @@ EXTCONST regexp_engine PL_core_reg_engine = { Perl_regfree_internal, Perl_reg_numbered_buff_get, Perl_reg_named_buff_get, - Perl_reg_qr_pkg, + Perl_reg_qr_package, #if defined(USE_ITHREADS) Perl_regdupe_internal #endif diff --git a/regexec.c b/regexec.c index aea0ad6..85804ab 100644 --- a/regexec.c +++ b/regexec.c @@ -308,7 +308,7 @@ S_regcppop(pTHX_ const regexp *rex) - pregexec - match a regexp against a string */ I32 -Perl_pregexec(pTHX_ register regexp *prog, char *stringarg, register char *strend, +Perl_pregexec(pTHX_ REGEXP * const prog, char* stringarg, register char *strend, char *strbeg, I32 minend, SV *screamer, U32 nosave) /* strend: pointer to null at end of string */ /* strbeg: real beginning of string */ @@ -372,7 +372,7 @@ Perl_pregexec(pTHX_ register regexp *prog, char *stringarg, register char *stren deleted from the finite automaton. */ char * -Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, +Perl_re_intuit_start(pTHX_ REGEXP * const prog, SV *sv, char *strpos, char *strend, U32 flags, re_scream_pos_data *data) { dVAR; @@ -1705,7 +1705,7 @@ S_swap_match_buff (pTHX_ regexp *prog) { - regexec_flags - match a regexp against a string */ I32 -Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char *strend, +Perl_regexec_flags(pTHX_ REGEXP * const prog, char *stringarg, register char *strend, char *strbeg, I32 minend, SV *sv, void *data, U32 flags) /* strend: pointer to null at end of string */ /* strbeg: real beginning of string */ diff --git a/regexp.h b/regexp.h index 33e7c20..ac9e96b 100644 --- a/regexp.h +++ b/regexp.h @@ -113,19 +113,21 @@ typedef struct re_scream_pos_data_s */ typedef struct regexp_engine { REGEXP* (*comp) (pTHX_ const SV * const pattern, const U32 flags); - I32 (*exec) (pTHX_ regexp* prog, char* stringarg, char* strend, - char* strbeg, I32 minend, SV* screamer, - void* data, U32 flags); - 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); - SV* (*numbered_buff_get) (pTHX_ const REGEXP * const rx, I32 paren, SV* usesv); - SV* (*named_buff_get)(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags); - SV* (*qr_pkg)(pTHX_ const REGEXP * const rx); + I32 (*exec) (pTHX_ REGEXP * const rx, char* stringarg, char* strend, + char* strbeg, I32 minend, SV* screamer, + void* data, U32 flags); + char* (*intuit) (pTHX_ REGEXP * const rx, SV *sv, char *strpos, + char *strend, U32 flags, + struct re_scream_pos_data_s *data); + SV* (*checkstr) (pTHX_ REGEXP * const rx); + void (*free) (pTHX_ REGEXP * const rx); + void (*numbered_buff_get) (pTHX_ REGEXP * const rx, + const I32 paren, SV * const usesv); + SV* (*named_buff_get)(pTHX_ REGEXP * const rx, SV * const namesv, + const U32 flags); + SV* (*qr_package)(pTHX_ REGEXP * const rx); #ifdef USE_ITHREADS - void* (*dupe) (pTHX_ const regexp *r, CLONE_PARAMS *param); + void* (*dupe) (pTHX_ REGEXP * const rx, CLONE_PARAMS *param); #endif } regexp_engine;