Change 33245 by [EMAIL PROTECTED] on 2008/02/07 15:50:02
Subject: Re: [PATCH] sv.c: consting
From: Steven Schubiger <[EMAIL PROTECTED]>
Date: Mon, 4 Feb 2008 15:44:19 +0100
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/embed.fnc#570 edit
... //depot/perl/pod/perlapi.pod#317 edit
... //depot/perl/proto.h#904 edit
... //depot/perl/sv.c#1503 edit
Differences ...
==== //depot/perl/embed.fnc#570 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#569~33231~ 2008-02-04 05:30:22.000000000 -0800
+++ perl/embed.fnc 2008-02-07 07:50:02.000000000 -0800
@@ -424,7 +424,7 @@
Apd |void |load_module|U32 flags|NN SV* name|NULLOK SV* ver|...
Ap |void |vload_module|U32 flags|NN SV* name|NULLOK SV* ver|NULLOK
va_list* args
p |OP* |localize |NN OP* arg|I32 lexical
-ApdR |I32 |looks_like_number|NN SV* sv
+ApdR |I32 |looks_like_number|NN SV *const sv
Apd |UV |grok_bin |NN const char* start|NN STRLEN* len_p|NN I32*
flags|NULLOK NV *result
Apd |UV |grok_hex |NN const char* start|NN STRLEN* len_p|NN I32*
flags|NULLOK NV *result
Apd |int |grok_number |NN const char *pv|STRLEN len|NULLOK UV *valuep
@@ -832,7 +832,7 @@
Apd |char* |sv_pvbyten |NN SV *sv|NN STRLEN *len
Apd |I32 |sv_true |NULLOK SV *sv
pd |void |sv_add_arena |NN char *const ptr|const U32 size|const U32
flags
-Apd |int |sv_backoff |NN SV* sv
+Apd |int |sv_backoff |NN SV *const sv
Apd |SV* |sv_bless |NN SV* sv|NN HV* stash
Afpd |void |sv_catpvf |NN SV* sv|NN const char* pat|...
Apd |void |sv_vcatpvf |NN SV* sv|NN const char* pat|NULLOK va_list*
args
@@ -859,7 +859,7 @@
poMX |void |sv_free2 |NN SV* sv
pd |void |sv_free_arenas
Apd |char* |sv_gets |NN SV* sv|NN PerlIO* fp|I32 append
-Apd |char* |sv_grow |NN SV* sv|STRLEN newlen
+Apd |char* |sv_grow |NN SV *const sv|STRLEN newlen
Apd |void |sv_inc |NN SV* sv
Apd |void |sv_insert |NN SV* bigsv|STRLEN offset|STRLEN len \
|NN const char* little|STRLEN littlelen
@@ -889,10 +889,10 @@
Apd |void |sv_reset |NN const char* s|NULLOK HV* stash
Afpd |void |sv_setpvf |NN SV* sv|NN const char* pat|...
Apd |void |sv_vsetpvf |NN SV* sv|NN const char* pat|NULLOK va_list*
args
-Apd |void |sv_setiv |NN SV* sv|IV num
+Apd |void |sv_setiv |NN SV *const sv|const IV num
Apdb |void |sv_setpviv |NN SV* sv|IV num
-Apd |void |sv_setuv |NN SV* sv|UV num
-Apd |void |sv_setnv |NN SV* sv|NV num
+Apd |void |sv_setuv |NN SV *const sv|const UV num
+Apd |void |sv_setnv |NN SV *const sv|const NV num
Apd |SV* |sv_setref_iv |NN SV* rv|NULLOK const char* classname|IV iv
Apd |SV* |sv_setref_uv |NN SV* rv|NULLOK const char* classname|UV uv
Apd |SV* |sv_setref_nv |NN SV* rv|NULLOK const char* classname|NV nv
@@ -907,7 +907,7 @@
Apdmb |void |sv_unref |NN SV* sv
Apd |void |sv_unref_flags |NN SV* sv|U32 flags
Apd |void |sv_untaint |NN SV* sv
-Apd |void |sv_upgrade |NN SV* sv|svtype new_type
+Apd |void |sv_upgrade |NN SV *const sv|svtype new_type
Apdmb |void |sv_usepvn |NN SV* sv|NULLOK char* ptr|STRLEN len
Apd |void |sv_usepvn_flags|NN SV* sv|NULLOK char* ptr|STRLEN len\
|U32 flags
@@ -1016,10 +1016,10 @@
Apdbm |void |sv_catsv_mg |NN SV *dstr|NULLOK SV *sstr
Afpd |void |sv_setpvf_mg |NN SV *sv|NN const char* pat|...
Apd |void |sv_vsetpvf_mg |NN SV* sv|NN const char* pat|NULLOK va_list*
args
-Apd |void |sv_setiv_mg |NN SV *sv|IV i
+Apd |void |sv_setiv_mg |NN SV *const sv|const IV i
Apdb |void |sv_setpviv_mg |NN SV *sv|IV iv
-Apd |void |sv_setuv_mg |NN SV *sv|UV u
-Apd |void |sv_setnv_mg |NN SV *sv|NV num
+Apd |void |sv_setuv_mg |NN SV *const sv|const UV u
+Apd |void |sv_setnv_mg |NN SV *const sv|const NV num
Apd |void |sv_setpv_mg |NN SV *sv|NULLOK const char *ptr
Apd |void |sv_setpvn_mg |NN SV *sv|NN const char *ptr|STRLEN len
Apd |void |sv_setsv_mg |NN SV *dstr|NULLOK SV *sstr
@@ -1494,7 +1494,7 @@
#if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
nsR |char * |uiv_2buf |NN char *buf|IV iv|UV uv|int is_uv|NN char
**peob
s |void |sv_unglob |NN SV* sv
-s |void |not_a_number |NN SV *sv
+s |void |not_a_number |NN SV *const sv
s |I32 |visit |NN SVFUNC_t f|const U32 flags|const U32 mask
s |void |sv_del_backref |NN SV *target|NN SV *ref
sR |SV * |varname |NULLOK GV *gv|const char gvtype|PADOFFSET targ
\
==== //depot/perl/pod/perlapi.pod#317 (text+w) ====
Index: perl/pod/perlapi.pod
--- perl/pod/perlapi.pod#316~33106~ 2008-01-29 07:06:55.000000000 -0800
+++ perl/pod/perlapi.pod 2008-02-07 07:50:02.000000000 -0800
@@ -5097,7 +5097,7 @@
C<Inf> and C<Infinity> are treated as numbers (so will not issue a
non-numeric warning), even if your atof() doesn't grok them.
- I32 looks_like_number(SV* sv)
+ I32 looks_like_number(SV *const sv)
=for hackers
Found in file sv.c
@@ -5448,7 +5448,7 @@
Remove any string offset. You should normally use the C<SvOOK_off> macro
wrapper instead.
- int sv_backoff(SV* sv)
+ int sv_backoff(SV *const sv)
=for hackers
Found in file sv.c
@@ -5735,7 +5735,7 @@
upgrades the SV to C<SVt_PV>. Returns a pointer to the character buffer.
Use the C<SvGROW> wrapper instead.
- char* sv_grow(SV* sv, STRLEN newlen)
+ char* sv_grow(SV *const sv, STRLEN newlen)
=for hackers
Found in file sv.c
@@ -6013,7 +6013,7 @@
Copies an integer into the given SV, upgrading first if necessary.
Does not handle 'set' magic. See also C<sv_setiv_mg>.
- void sv_setiv(SV* sv, IV num)
+ void sv_setiv(SV *const sv, const IV num)
=for hackers
Found in file sv.c
@@ -6023,7 +6023,7 @@
Like C<sv_setiv>, but also handles 'set' magic.
- void sv_setiv_mg(SV *sv, IV i)
+ void sv_setiv_mg(SV *const sv, const IV i)
=for hackers
Found in file sv.c
@@ -6034,7 +6034,7 @@
Copies a double into the given SV, upgrading first if necessary.
Does not handle 'set' magic. See also C<sv_setnv_mg>.
- void sv_setnv(SV* sv, NV num)
+ void sv_setnv(SV *const sv, const NV num)
=for hackers
Found in file sv.c
@@ -6044,7 +6044,7 @@
Like C<sv_setnv>, but also handles 'set' magic.
- void sv_setnv_mg(SV *sv, NV num)
+ void sv_setnv_mg(SV *const sv, const NV num)
=for hackers
Found in file sv.c
@@ -6282,7 +6282,7 @@
Copies an unsigned integer into the given SV, upgrading first if necessary.
Does not handle 'set' magic. See also C<sv_setuv_mg>.
- void sv_setuv(SV* sv, UV num)
+ void sv_setuv(SV *const sv, const UV num)
=for hackers
Found in file sv.c
@@ -6292,7 +6292,7 @@
Like C<sv_setuv>, but also handles 'set' magic.
- void sv_setuv_mg(SV *sv, UV u)
+ void sv_setuv_mg(SV *const sv, const UV u)
=for hackers
Found in file sv.c
@@ -6360,7 +6360,7 @@
SV, then copies across as much information as possible from the old body.
You generally want to use the C<SvUPGRADE> macro wrapper. See also C<svtype>.
- void sv_upgrade(SV* sv, svtype new_type)
+ void sv_upgrade(SV *const sv, svtype new_type)
=for hackers
Found in file sv.c
==== //depot/perl/proto.h#904 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#903~33231~ 2008-02-04 05:30:22.000000000 -0800
+++ perl/proto.h 2008-02-07 07:50:02.000000000 -0800
@@ -1057,7 +1057,7 @@
PERL_CALLCONV OP* Perl_localize(pTHX_ OP* arg, I32 lexical)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV I32 Perl_looks_like_number(pTHX_ SV* sv)
+PERL_CALLCONV I32 Perl_looks_like_number(pTHX_ SV *const sv)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
@@ -2226,7 +2226,7 @@
PERL_CALLCONV void Perl_sv_add_arena(pTHX_ char *const ptr, const U32
size, const U32 flags)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV int Perl_sv_backoff(pTHX_ SV* sv)
+PERL_CALLCONV int Perl_sv_backoff(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_sv_bless(pTHX_ SV* sv, HV* stash)
@@ -2310,7 +2310,7 @@
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
-PERL_CALLCONV char* Perl_sv_grow(pTHX_ SV* sv, STRLEN newlen)
+PERL_CALLCONV char* Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV void Perl_sv_inc(pTHX_ SV* sv)
@@ -2388,16 +2388,16 @@
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
-PERL_CALLCONV void Perl_sv_setiv(pTHX_ SV* sv, IV num)
+PERL_CALLCONV void Perl_sv_setiv(pTHX_ SV *const sv, const IV num)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV void Perl_sv_setpviv(pTHX_ SV* sv, IV num)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_sv_setuv(pTHX_ SV* sv, UV num)
+PERL_CALLCONV void Perl_sv_setuv(pTHX_ SV *const sv, const UV num)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_sv_setnv(pTHX_ SV* sv, NV num)
+PERL_CALLCONV void Perl_sv_setnv(pTHX_ SV *const sv, const NV num)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_sv_setref_iv(pTHX_ SV* rv, const char* classname,
IV iv)
@@ -2444,7 +2444,7 @@
PERL_CALLCONV void Perl_sv_untaint(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_sv_upgrade(pTHX_ SV* sv, svtype new_type)
+PERL_CALLCONV void Perl_sv_upgrade(pTHX_ SV *const sv, svtype new_type)
__attribute__nonnull__(pTHX_1);
/* PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV* sv, char* ptr, STRLEN len)
@@ -2728,16 +2728,16 @@
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
-PERL_CALLCONV void Perl_sv_setiv_mg(pTHX_ SV *sv, IV i)
+PERL_CALLCONV void Perl_sv_setiv_mg(pTHX_ SV *const sv, const IV i)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV void Perl_sv_setpviv_mg(pTHX_ SV *sv, IV iv)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_sv_setuv_mg(pTHX_ SV *sv, UV u)
+PERL_CALLCONV void Perl_sv_setuv_mg(pTHX_ SV *const sv, const UV u)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_sv_setnv_mg(pTHX_ SV *sv, NV num)
+PERL_CALLCONV void Perl_sv_setnv_mg(pTHX_ SV *const sv, const NV num)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV void Perl_sv_setpv_mg(pTHX_ SV *sv, const char *ptr)
@@ -3953,7 +3953,7 @@
STATIC void S_sv_unglob(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1);
-STATIC void S_not_a_number(pTHX_ SV *sv)
+STATIC void S_not_a_number(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
STATIC I32 S_visit(pTHX_ SVFUNC_t f, const U32 flags, const U32 mask)
==== //depot/perl/sv.c#1503 (text) ====
Index: perl/sv.c
--- perl/sv.c#1502~33231~ 2008-02-04 05:30:22.000000000 -0800
+++ perl/sv.c 2008-02-07 07:50:02.000000000 -0800
@@ -1114,7 +1114,7 @@
*/
void
-Perl_sv_upgrade(pTHX_ register SV *sv, svtype new_type)
+Perl_sv_upgrade(pTHX_ register SV *const sv, svtype new_type)
{
dVAR;
void* old_body;
@@ -1398,7 +1398,7 @@
*/
int
-Perl_sv_backoff(pTHX_ register SV *sv)
+Perl_sv_backoff(pTHX_ register SV *const sv)
{
STRLEN delta;
const char * const s = SvPVX_const(sv);
@@ -1427,7 +1427,7 @@
*/
char *
-Perl_sv_grow(pTHX_ register SV *sv, register STRLEN newlen)
+Perl_sv_grow(pTHX_ register SV *const sv, register STRLEN newlen)
{
register char *s;
@@ -1495,7 +1495,7 @@
*/
void
-Perl_sv_setiv(pTHX_ register SV *sv, IV i)
+Perl_sv_setiv(pTHX_ register SV *const sv, const IV i)
{
dVAR;
SV_CHECK_THINKFIRST_COW_DROP(sv);
@@ -1532,7 +1532,7 @@
*/
void
-Perl_sv_setiv_mg(pTHX_ register SV *sv, IV i)
+Perl_sv_setiv_mg(pTHX_ register SV *const sv, const IV i)
{
sv_setiv(sv,i);
SvSETMAGIC(sv);
@@ -1548,7 +1548,7 @@
*/
void
-Perl_sv_setuv(pTHX_ register SV *sv, UV u)
+Perl_sv_setuv(pTHX_ register SV *const sv, const UV u)
{
/* With these two if statements:
u=1.49 s=0.52 cu=72.49 cs=10.64 scripts=270 tests=20865
@@ -1576,7 +1576,7 @@
*/
void
-Perl_sv_setuv_mg(pTHX_ register SV *sv, UV u)
+Perl_sv_setuv_mg(pTHX_ register SV *const sv, const UV u)
{
sv_setuv(sv,u);
SvSETMAGIC(sv);
@@ -1592,7 +1592,7 @@
*/
void
-Perl_sv_setnv(pTHX_ register SV *sv, NV num)
+Perl_sv_setnv(pTHX_ register SV *const sv, const NV num)
{
dVAR;
SV_CHECK_THINKFIRST_COW_DROP(sv);
@@ -1630,7 +1630,7 @@
*/
void
-Perl_sv_setnv_mg(pTHX_ register SV *sv, NV num)
+Perl_sv_setnv_mg(pTHX_ register SV *const sv, const NV num)
{
sv_setnv(sv,num);
SvSETMAGIC(sv);
@@ -1641,7 +1641,7 @@
*/
STATIC void
-S_not_a_number(pTHX_ SV *sv)
+S_not_a_number(pTHX_ SV *const sv)
{
dVAR;
SV *dsv;
@@ -1722,7 +1722,7 @@
*/
I32
-Perl_looks_like_number(pTHX_ SV *sv)
+Perl_looks_like_number(pTHX_ SV *const sv)
{
register const char *sbegin;
STRLEN len;
End of Patch.