Change 33249 by [EMAIL PROTECTED] on 2008/02/08 11:15:36
Subject: Re: [PATCH] sv.c: consting
From: Steven Schubiger <[EMAIL PROTECTED]>
Date: Thu, 7 Feb 2008 17:51:58 +0100
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/embed.fnc#571 edit
... //depot/perl/pod/perlapi.pod#318 edit
... //depot/perl/pod/perlintern.pod#72 edit
... //depot/perl/proto.h#905 edit
... //depot/perl/sv.c#1504 edit
Differences ...
==== //depot/perl/embed.fnc#571 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#570~33245~ 2008-02-07 07:50:02.000000000 -0800
+++ perl/embed.fnc 2008-02-08 03:15:36.000000000 -0800
@@ -813,17 +813,17 @@
s |char* |glob_2pv |NN GV* const gv|NULLOK STRLEN * const len
#endif
Amb |IV |sv_2iv |NN SV* sv
-Apd |IV |sv_2iv_flags |NN SV* sv|I32 flags
+Apd |IV |sv_2iv_flags |NN SV *const sv|const I32 flags
Apd |SV* |sv_2mortal |NULLOK SV* sv
-Apd |NV |sv_2nv |NN SV* sv
-pMd |SV* |sv_2num |NN SV* sv
+Apd |NV |sv_2nv |NN SV *const sv
+pMd |SV* |sv_2num |NN SV *const sv
Amb |char* |sv_2pv |NN SV* sv|NULLOK STRLEN* lp
-Apd |char* |sv_2pv_flags |NN SV* sv|NULLOK STRLEN* lp|I32 flags
+Apd |char* |sv_2pv_flags |NN SV *const sv|NULLOK STRLEN *const lp|const
I32 flags
Apd |char* |sv_2pvutf8 |NN SV* sv|NULLOK STRLEN* lp
-Apd |char* |sv_2pvbyte |NN SV* sv|NULLOK STRLEN* lp
+Apd |char* |sv_2pvbyte |NN SV *const sv|NULLOK STRLEN *const lp
Ap |char* |sv_pvn_nomg |NN SV* sv|NULLOK STRLEN* lp
Amb |UV |sv_2uv |NN SV* sv
-Apd |UV |sv_2uv_flags |NN SV* sv|I32 flags
+Apd |UV |sv_2uv_flags |NN SV *const sv|const I32 flags
Apd |IV |sv_iv |NN SV* sv
Apd |UV |sv_uv |NN SV* sv
Apd |NV |sv_nv |NN SV* sv
@@ -1492,7 +1492,7 @@
#endif
#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
+nsR |char * |uiv_2buf |NN char *const buf|const IV iv|UV uv|const int
is_uv|NN char **const peob
s |void |sv_unglob |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
@@ -1504,9 +1504,9 @@
# endif
# if !defined(NV_PRESERVES_UV)
# ifdef DEBUGGING
-s |int |sv_2iuv_non_preserve |NN SV *sv|I32 numtype
+s |int |sv_2iuv_non_preserve |NN SV *const sv|I32 numtype
# else
-s |int |sv_2iuv_non_preserve |NN SV *sv
+s |int |sv_2iuv_non_preserve |NN SV *const sv
# endif
# endif
sR |I32 |expect_number |NN char** pattern
@@ -1528,7 +1528,7 @@
# endif
s |SV * |more_sv
s |void * |more_bodies |const svtype sv_type
-s |bool |sv_2iuv_common |NN SV *sv
+s |bool |sv_2iuv_common |NN SV *const sv
s |void |glob_assign_glob|NN SV *dstr|NN SV *sstr|const int dtype
s |void |glob_assign_ref|NN SV *dstr|NN SV *sstr
sRn |PTR_TBL_ENT_t *|ptr_table_find|NN PTR_TBL_t *tbl|NN const void *sv
@@ -1626,7 +1626,7 @@
Apd |void |sv_catsv_flags |NN SV* dsv|NULLOK SV* ssv|I32 flags
Apd |STRLEN |sv_utf8_upgrade_flags|NN SV *sv|I32 flags
Apd |char* |sv_pvn_force_flags|NN SV* sv|NULLOK STRLEN* lp|I32 flags
-Apd |void |sv_copypv |NN SV* dsv|NN SV* ssv
+Apd |void |sv_copypv |NN SV *const dsv|NN SV *const ssv
Ap |char* |my_atof2 |NN const char *s|NN NV* value
Apn |int |my_socketpair |int family|int type|int protocol|int fd[2]
Ap |int |my_dirfd |NULLOK DIR* dir
==== //depot/perl/pod/perlapi.pod#318 (text+w) ====
Index: perl/pod/perlapi.pod
--- perl/pod/perlapi.pod#317~33245~ 2008-02-07 07:50:02.000000000 -0800
+++ perl/pod/perlapi.pod 2008-02-08 03:15:36.000000000 -0800
@@ -5358,7 +5358,7 @@
conversion. If flags includes SV_GMAGIC, does an mg_get() first.
Normally used via the C<SvIV(sv)> and C<SvIVx(sv)> macros.
- IV sv_2iv_flags(SV* sv, I32 flags)
+ IV sv_2iv_flags(SV *const sv, const I32 flags)
=for hackers
Found in file sv.c
@@ -5384,7 +5384,7 @@
conversion, magic etc. Normally used via the C<SvNV(sv)> and C<SvNVx(sv)>
macros.
- NV sv_2nv(SV* sv)
+ NV sv_2nv(SV *const sv)
=for hackers
Found in file sv.c
@@ -5398,7 +5398,7 @@
Usually accessed via the C<SvPVbyte> macro.
- char* sv_2pvbyte(SV* sv, STRLEN* lp)
+ char* sv_2pvbyte(SV *const sv, STRLEN *const lp)
=for hackers
Found in file sv.c
@@ -5425,7 +5425,7 @@
Normally invoked via the C<SvPV_flags> macro. C<sv_2pv()> and C<sv_2pv_nomg>
usually end up here too.
- char* sv_2pv_flags(SV* sv, STRLEN* lp, I32 flags)
+ char* sv_2pv_flags(SV *const sv, STRLEN *const lp, const I32 flags)
=for hackers
Found in file sv.c
@@ -5437,7 +5437,7 @@
conversion. If flags includes SV_GMAGIC, does an mg_get() first.
Normally used via the C<SvUV(sv)> and C<SvUVx(sv)> macros.
- UV sv_2uv_flags(SV* sv, I32 flags)
+ UV sv_2uv_flags(SV *const sv, const I32 flags)
=for hackers
Found in file sv.c
@@ -5658,7 +5658,7 @@
string. Mostly uses sv_2pv_flags to do its work, except when that
would lose the UTF-8'ness of the PV.
- void sv_copypv(SV* dsv, SV* ssv)
+ void sv_copypv(SV *const dsv, SV *const ssv)
=for hackers
Found in file sv.c
==== //depot/perl/pod/perlintern.pod#72 (text+w) ====
Index: perl/pod/perlintern.pod
--- perl/pod/perlintern.pod#71~33231~ 2008-02-04 05:30:22.000000000 -0800
+++ perl/pod/perlintern.pod 2008-02-08 03:15:36.000000000 -0800
@@ -1050,7 +1050,7 @@
reference or overload conversion. You must use the C<SvNUM(sv)> macro to
access this function.
- SV* sv_2num(SV* sv)
+ SV* sv_2num(SV *const sv)
=for hackers
Found in file sv.c
==== //depot/perl/proto.h#905 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#904~33245~ 2008-02-07 07:50:02.000000000 -0800
+++ perl/proto.h 2008-02-08 03:15:36.000000000 -0800
@@ -2170,26 +2170,26 @@
/* PERL_CALLCONV IV Perl_sv_2iv(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1); */
-PERL_CALLCONV IV Perl_sv_2iv_flags(pTHX_ SV* sv, I32 flags)
+PERL_CALLCONV IV Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_sv_2mortal(pTHX_ SV* sv);
-PERL_CALLCONV NV Perl_sv_2nv(pTHX_ SV* sv)
+PERL_CALLCONV NV Perl_sv_2nv(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV SV* Perl_sv_2num(pTHX_ SV* sv)
+PERL_CALLCONV SV* Perl_sv_2num(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
/* PERL_CALLCONV char* Perl_sv_2pv(pTHX_ SV* sv, STRLEN* lp)
__attribute__nonnull__(pTHX_1); */
-PERL_CALLCONV char* Perl_sv_2pv_flags(pTHX_ SV* sv, STRLEN* lp, I32 flags)
+PERL_CALLCONV char* Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp,
const I32 flags)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV char* Perl_sv_2pvutf8(pTHX_ SV* sv, STRLEN* lp)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV char* Perl_sv_2pvbyte(pTHX_ SV* sv, STRLEN* lp)
+PERL_CALLCONV char* Perl_sv_2pvbyte(pTHX_ SV *const sv, STRLEN *const lp)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV char* Perl_sv_pvn_nomg(pTHX_ SV* sv, STRLEN* lp)
@@ -2198,7 +2198,7 @@
/* PERL_CALLCONV UV Perl_sv_2uv(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1); */
-PERL_CALLCONV UV Perl_sv_2uv_flags(pTHX_ SV* sv, I32 flags)
+PERL_CALLCONV UV Perl_sv_2uv_flags(pTHX_ SV *const sv, const I32 flags)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV IV Perl_sv_iv(pTHX_ SV* sv)
@@ -3945,7 +3945,7 @@
#endif
#if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
-STATIC char * S_uiv_2buf(char *buf, IV iv, UV uv, int is_uv, char **peob)
+STATIC char * S_uiv_2buf(char *const buf, const IV iv, UV uv, const int
is_uv, char **const peob)
__attribute__warn_unused_result__
__attribute__nonnull__(1)
__attribute__nonnull__(5);
@@ -3973,11 +3973,11 @@
# endif
# if !defined(NV_PRESERVES_UV)
# ifdef DEBUGGING
-STATIC int S_sv_2iuv_non_preserve(pTHX_ SV *sv, I32 numtype)
+STATIC int S_sv_2iuv_non_preserve(pTHX_ SV *const sv, I32 numtype)
__attribute__nonnull__(pTHX_1);
# else
-STATIC int S_sv_2iuv_non_preserve(pTHX_ SV *sv)
+STATIC int S_sv_2iuv_non_preserve(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
# endif
@@ -4023,7 +4023,7 @@
# endif
STATIC SV * S_more_sv(pTHX);
STATIC void * S_more_bodies(pTHX_ const svtype sv_type);
-STATIC bool S_sv_2iuv_common(pTHX_ SV *sv)
+STATIC bool S_sv_2iuv_common(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
STATIC void S_glob_assign_glob(pTHX_ SV *dstr, SV *sstr, const int dtype)
@@ -4243,7 +4243,7 @@
PERL_CALLCONV char* Perl_sv_pvn_force_flags(pTHX_ SV* sv, STRLEN* lp, I32
flags)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_sv_copypv(pTHX_ SV* dsv, SV* ssv)
+PERL_CALLCONV void Perl_sv_copypv(pTHX_ SV *const dsv, SV *const ssv)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
==== //depot/perl/sv.c#1504 (text) ====
Index: perl/sv.c
--- perl/sv.c#1503~33245~ 2008-02-07 07:50:02.000000000 -0800
+++ perl/sv.c 2008-02-08 03:15:36.000000000 -0800
@@ -1863,7 +1863,7 @@
/* For sv_2nv these three cases are "SvNOK and don't bother casting" */
STATIC int
-S_sv_2iuv_non_preserve(pTHX_ register SV *sv
+S_sv_2iuv_non_preserve(pTHX_ register SV *const sv
# ifdef DEBUGGING
, I32 numtype
# endif
@@ -1915,7 +1915,7 @@
#endif /* !NV_PRESERVES_UV*/
STATIC bool
-S_sv_2iuv_common(pTHX_ SV *sv) {
+S_sv_2iuv_common(pTHX_ SV *const sv) {
dVAR;
if (SvNOKp(sv)) {
/* erm. not sure. *should* never get NOKp (without NOK) from sv_2nv
@@ -2191,7 +2191,7 @@
*/
IV
-Perl_sv_2iv_flags(pTHX_ register SV *sv, I32 flags)
+Perl_sv_2iv_flags(pTHX_ register SV *const sv, const I32 flags)
{
dVAR;
if (!sv)
@@ -2275,7 +2275,7 @@
*/
UV
-Perl_sv_2uv_flags(pTHX_ register SV *sv, I32 flags)
+Perl_sv_2uv_flags(pTHX_ register SV *const sv, const I32 flags)
{
dVAR;
if (!sv)
@@ -2352,7 +2352,7 @@
*/
NV
-Perl_sv_2nv(pTHX_ register SV *sv)
+Perl_sv_2nv(pTHX_ register SV *const sv)
{
dVAR;
if (!sv)
@@ -2577,7 +2577,7 @@
*/
SV *
-Perl_sv_2num(pTHX_ register SV *sv)
+Perl_sv_2num(pTHX_ register SV *const sv)
{
if (!SvROK(sv))
return sv;
@@ -2597,7 +2597,7 @@
*/
static char *
-S_uiv_2buf(char *buf, IV iv, UV uv, int is_uv, char **peob)
+S_uiv_2buf(char *const buf, const IV iv, UV uv, const int is_uv, char **const
peob)
{
char *ptr = buf + TYPE_CHARS(UV);
char * const ebuf = ptr;
@@ -2634,7 +2634,7 @@
*/
char *
-Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
+Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32
flags)
{
dVAR;
register char *s;
@@ -2919,7 +2919,7 @@
*/
void
-Perl_sv_copypv(pTHX_ SV *dsv, register SV *ssv)
+Perl_sv_copypv(pTHX_ SV *const dsv, register SV *const ssv)
{
STRLEN len;
const char * const s = SvPV_const(ssv,len);
@@ -2943,7 +2943,7 @@
*/
char *
-Perl_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
+Perl_sv_2pvbyte(pTHX_ register SV *const sv, STRLEN *const lp)
{
sv_utf8_downgrade(sv,0);
return lp ? SvPV(sv,*lp) : SvPV_nolen(sv);
End of Patch.