From: Nicholas Clark Date: Thu, 30 Oct 2008 22:08:41 +0000 (+0000) Subject: SvPV() does not take a const SV*, which means that the pattern argument X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1593ad57168f1432573f8effd44b7610e9f8f962;p=p5sagit%2Fp5-mst-13.2.git SvPV() does not take a const SV*, which means that the pattern argument to Perl_re_compile() can't be const, which means that the pattern argument to Perl_pregcomp() can't be const, as can't the argument in the function in the regexp engine structure. It's a shame that no-one spotted this earlier. (Again) I may have rendered the documentation inaccurate. p4raw-id: //depot/perl@34672 --- diff --git a/embed.fnc b/embed.fnc index 192e71d..5b0736a 100644 --- a/embed.fnc +++ b/embed.fnc @@ -724,8 +724,8 @@ Ap |void |regfree_internal|NN REGEXP *const rx #if defined(USE_ITHREADS) 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|U32 flags +Ap |REGEXP*|pregcomp |NN SV * const pattern|const U32 flags +Ap |REGEXP*|re_compile |NN SV * const pattern|U32 flags Ap |char* |re_intuit_start|NN REGEXP * const rx|NULLOK SV* sv|NN char* strpos \ |NN char* strend|const U32 flags \ |NULLOK re_scream_pos_data *data diff --git a/proto.h b/proto.h index 1be6c1e..a4cc460 100644 --- a/proto.h +++ b/proto.h @@ -2580,12 +2580,12 @@ PERL_CALLCONV void* Perl_regdupe_internal(pTHX_ REGEXP * const r, CLONE_PARAMS* assert(r); assert(param) #endif -PERL_CALLCONV REGEXP* Perl_pregcomp(pTHX_ const SV * const pattern, const U32 flags) +PERL_CALLCONV REGEXP* Perl_pregcomp(pTHX_ SV * const pattern, const U32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_PREGCOMP \ assert(pattern) -PERL_CALLCONV REGEXP* Perl_re_compile(pTHX_ const SV * const pattern, U32 flags) +PERL_CALLCONV REGEXP* Perl_re_compile(pTHX_ SV * const pattern, U32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_RE_COMPILE \ assert(pattern) diff --git a/regcomp.c b/regcomp.c index da68910..8e197f7 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4157,7 +4157,7 @@ extern const struct regexp_engine my_reg_engine; #ifndef PERL_IN_XSUB_RE REGEXP * -Perl_pregcomp(pTHX_ const SV * const pattern, const U32 flags) +Perl_pregcomp(pTHX_ SV * const pattern, const U32 flags) { dVAR; HV * const table = GvHV(PL_hintgv); @@ -4183,14 +4183,14 @@ Perl_pregcomp(pTHX_ const SV * const pattern, const U32 flags) #endif REGEXP * -Perl_re_compile(pTHX_ const SV * const pattern, U32 pm_flags) +Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags) { dVAR; REGEXP *rx; struct regexp *r; register regexp_internal *ri; STRLEN plen; - char* exp = SvPV((SV*)pattern, plen); + char *exp = SvPV(pattern, plen); char* xend = exp + plen; regnode *scan; I32 flags; diff --git a/regexp.h b/regexp.h index 2bdcf26..8cce3b3 100644 --- a/regexp.h +++ b/regexp.h @@ -129,7 +129,7 @@ typedef struct re_scream_pos_data_s * Any regex engine implementation must be able to build one of these. */ typedef struct regexp_engine { - REGEXP* (*comp) (pTHX_ const SV * const pattern, U32 flags); + REGEXP* (*comp) (pTHX_ SV * const pattern, U32 flags); I32 (*exec) (pTHX_ REGEXP * const rx, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, void* data, U32 flags);