Change 24742 by [EMAIL PROTECTED] on 2005/06/07 19:45:13
More consting of SvPV
Affected files ...
... //depot/perl/embed.fnc#192 edit
... //depot/perl/pp_ctl.c#446 edit
... //depot/perl/proto.h#543 edit
... //depot/perl/sv.c#877 edit
Differences ...
==== //depot/perl/embed.fnc#192 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#191~24736~ Tue Jun 7 10:35:10 2005
+++ perl/embed.fnc Tue Jun 7 12:45:13 2005
@@ -1263,10 +1263,12 @@
s |SV* |gv_share |SV *sv|CLONE_PARAMS *param
# endif
s |bool |utf8_mg_pos |NN SV *sv|NN MAGIC **mgp|NN STRLEN **cachep \
- |I32 i|NN I32 *offsetp|I32 uoff|NN U8 **sp \
- |NN U8 *start|NN U8 *send
-s |bool |utf8_mg_pos_init |NN SV *sv|NN MAGIC **mgp|NN STRLEN
**cachep \
- |I32 i|I32 offsetp|NN U8 *s|NN U8 *start
+ |I32 i|NN I32 *offsetp|I32 uoff \
+ |NN const U8 **sp|NN const U8 *start \
+ |NN const U8 *send
+s |bool |utf8_mg_pos_init |NN SV *sv|NN MAGIC **mgp \
+ |NN STRLEN **cachep|I32 i|I32 offsetp \
+ |NN const U8 *s|NN const U8 *start
#if defined(PERL_COPY_ON_WRITE)
sM |void |sv_release_COW |SV *sv|const char *pvx|STRLEN cur|STRLEN len \
|U32 hash|SV *after
==== //depot/perl/pp_ctl.c#446 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#445~24740~ Tue Jun 7 11:38:39 2005
+++ perl/pp_ctl.c Tue Jun 7 12:45:13 2005
@@ -388,7 +388,7 @@
register SV *tmpForm = *++MARK;
register U32 *fpc;
register char *t;
- register char *f;
+ const char *f;
register char *s;
register char *send;
register I32 arg;
@@ -428,11 +428,9 @@
targ_is_utf8 = TRUE;
t = SvGROW(PL_formtarget, len + fudge + 1); /* XXX SvCUR bad */
t += len;
- f = SvPV(tmpForm, len);
+ f = SvPV_const(tmpForm, len);
/* need to jump to the next word */
- s = f + len + WORD_ALIGN - SvCUR(tmpForm) % WORD_ALIGN;
-
- fpc = (U32*)s;
+ fpc = (U32*)(f + len + WORD_ALIGN - SvCUR(tmpForm) % WORD_ALIGN);
for (;;) {
DEBUG_f( {
@@ -511,7 +509,7 @@
break;
case FF_CHECKNL:
- item = s = SvPV(sv, len);
+ s = item = SvPV(sv, len);
itemsize = len;
if (DO_UTF8(sv)) {
itemsize = sv_len_utf8(sv);
@@ -553,7 +551,7 @@
break;
case FF_CHECKCHOP:
- item = s = SvPV(sv, len);
+ s = item = SvPV(sv, len);
itemsize = len;
if (DO_UTF8(sv)) {
itemsize = sv_len_utf8(sv);
@@ -732,7 +730,7 @@
case FF_LINEGLOB:
oneline = FALSE;
ff_line:
- item = s = SvPV(sv, len);
+ s = item = SvPV(sv, len);
itemsize = len;
if ((item_is_utf8 = DO_UTF8(sv)))
itemsize = sv_len_utf8(sv);
==== //depot/perl/proto.h#543 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#542~24736~ Tue Jun 7 10:35:10 2005
+++ perl/proto.h Tue Jun 7 12:45:13 2005
@@ -2382,7 +2382,7 @@
# if defined(USE_ITHREADS)
STATIC SV* S_gv_share(pTHX_ SV *sv, CLONE_PARAMS *param);
# endif
-STATIC bool S_utf8_mg_pos(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32
i, I32 *offsetp, I32 uoff, U8 **sp, U8 *start, U8 *send)
+STATIC bool S_utf8_mg_pos(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32
i, I32 *offsetp, I32 uoff, const U8 **sp, const U8 *start, const U8 *send)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3)
@@ -2391,7 +2391,7 @@
__attribute__nonnull__(pTHX_8)
__attribute__nonnull__(pTHX_9);
-STATIC bool S_utf8_mg_pos_init(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep,
I32 i, I32 offsetp, U8 *s, U8 *start)
+STATIC bool S_utf8_mg_pos_init(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep,
I32 i, I32 offsetp, const U8 *s, const U8 *start)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3)
==== //depot/perl/sv.c#877 (text) ====
Index: perl/sv.c
--- perl/sv.c#876~24740~ Tue Jun 7 11:38:39 2005
+++ perl/sv.c Tue Jun 7 12:45:13 2005
@@ -6226,7 +6226,8 @@
*
*/
STATIC bool
-S_utf8_mg_pos_init(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i, I32
offsetp, U8 *s, U8 *start)
+S_utf8_mg_pos_init(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i,
+ I32 offsetp, const U8 *s, const U8 *start)
{
bool found = FALSE;
@@ -6259,7 +6260,7 @@
*
*/
STATIC bool
-S_utf8_mg_pos(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i, I32 *offsetp,
I32 uoff, U8 **sp, U8 *start, U8 *send)
+S_utf8_mg_pos(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i, I32 *offsetp,
I32 uoff, const U8 **sp, const U8 *start, const U8 *send)
{
bool found = FALSE;
@@ -6391,21 +6392,21 @@
void
Perl_sv_pos_u2b(pTHX_ register SV *sv, I32* offsetp, I32* lenp)
{
- U8 *start;
+ const U8 *start;
STRLEN len;
if (!sv)
return;
- start = (U8*)SvPV(sv, len);
+ start = (U8*)SvPV_const(sv, len);
if (len) {
STRLEN boffset = 0;
STRLEN *cache = 0;
- U8 *s = start;
- I32 uoffset = *offsetp;
- U8 *send = s + len;
- MAGIC *mg = 0;
- bool found = FALSE;
+ const U8 *s = start;
+ I32 uoffset = *offsetp;
+ const U8 *send = s + len;
+ MAGIC *mg = 0;
+ bool found = FALSE;
if (utf8_mg_pos(sv, &mg, &cache, 0, offsetp, *offsetp, &s, start,
send))
found = TRUE;
@@ -9309,7 +9310,7 @@
const char *eptr = Nullch;
STRLEN elen = 0;
SV *vecsv = Nullsv;
- U8 *vecstr = Null(U8*);
+ const U8 *vecstr = Null(U8*);
STRLEN veclen = 0;
char c = 0;
int i;
@@ -9429,18 +9430,18 @@
else
vecsv = (evix ? evix <= svmax : svix < svmax) ?
svargs[evix ? evix-1 : svix++] : &PL_sv_undef;
- dotstr = SvPVx(vecsv, dotstrlen);
+ dotstr = SvPV_const(vecsv, dotstrlen);
if (DO_UTF8(vecsv))
is_utf8 = TRUE;
}
if (args) {
vecsv = va_arg(*args, SV*);
- vecstr = (U8*)SvPVx(vecsv,veclen);
+ vecstr = (U8*)SvPV_const(vecsv,veclen);
vec_utf8 = DO_UTF8(vecsv);
}
else if (efix ? efix <= svmax : svix < svmax) {
vecsv = svargs[efix ? efix-1 : svix++];
- vecstr = (U8*)SvPVx(vecsv,veclen);
+ vecstr = (U8*)SvPV_const(vecsv,veclen);
vec_utf8 = DO_UTF8(vecsv);
/* if this is a version object, we need to return the
* stringified representation (which the SvPVX_const has
@@ -9449,7 +9450,7 @@
if ( *q == 'd' && sv_derived_from(vecsv,"version") )
{
q++; /* skip past the rest of the %vd format */
- eptr = (char *) vecstr;
+ eptr = (const char *) vecstr;
elen = strlen(eptr);
vectorize=FALSE;
goto string;
End of Patch.