[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-changes
Subject:    Change 34672: SvPV() does not take a const SV*, which means that the pattern argument
From:       Nicholas Clark <nwc10+p5p4 () colon ! colondot ! net>
Date:       2008-10-30 22:15:02
Message-ID: 20081030221502.5528614006 () mx ! activestate ! com
[Download RAW message or body]

Change 34672 by nicholas@nicholas-saigo on 2008/10/30 22:08:41

	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.

Affected files ...

... //depot/perl/embed.fnc#627 edit
... //depot/perl/proto.h#962 edit
... //depot/perl/regcomp.c#666 edit
... //depot/perl/regexp.h#139 edit

Differences ...

==== //depot/perl/embed.fnc#627 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#626~34645~	2008-10-29 14:24:54.000000000 -0700
+++ perl/embed.fnc	2008-10-30 15:08:41.000000000 -0700
@@ -724,8 +724,8 @@
 #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

==== //depot/perl/proto.h#962 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#961~34645~	2008-10-29 14:24:54.000000000 -0700
+++ perl/proto.h	2008-10-30 15:08:41.000000000 -0700
@@ -2580,12 +2580,12 @@
 	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)

==== //depot/perl/regcomp.c#666 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#665~34653~	2008-10-29 16:04:34.000000000 -0700
+++ perl/regcomp.c	2008-10-30 15:08:41.000000000 -0700
@@ -4157,7 +4157,7 @@
 
 #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 @@
 #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;

==== //depot/perl/regexp.h#139 (text) ====
Index: perl/regexp.h
--- perl/regexp.h#138~34585~	2008-10-25 05:23:01.000000000 -0700
+++ perl/regexp.h	2008-10-30 15:08:41.000000000 -0700
@@ -129,7 +129,7 @@
  * 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);
End of Patch.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic