Skip to content

Commit 66ceb53

Browse files
stscrgs
authored andcommitted
Re: [PATCH] sv.c: consting
Message-ID: <[email protected]> p4raw-id: //depot/perl@33507
1 parent 4386d69 commit 66ceb53

File tree

4 files changed

+52
-48
lines changed

4 files changed

+52
-48
lines changed

embed.fnc

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,9 @@ Apd |I32 |sv_true |NULLOK SV *const sv
853853
pd |void |sv_add_arena |NN char *const ptr|const U32 size|const U32 flags
854854
Apd |int |sv_backoff |NN SV *const sv
855855
Apd |SV* |sv_bless |NN SV *const sv|NN HV *const stash
856-
Afpd |void |sv_catpvf |NN SV* sv|NN const char* pat|...
857-
Apd |void |sv_vcatpvf |NN SV* sv|NN const char* pat|NULLOK va_list* args
856+
Afpd |void |sv_catpvf |NN SV *const sv|NN const char *const pat|...
857+
Apd |void |sv_vcatpvf |NN SV *const sv|NN const char *const pat \
858+
|NULLOK va_list *const args
858859
Apd |void |sv_catpv |NN SV *const sv|NULLOK const char* ptr
859860
Amdb |void |sv_catpvn |NN SV *dsv|NN const char *sstr|STRLEN len
860861
Amdb |void |sv_catsv |NN SV *dstr|NULLOK SV *sstr
@@ -934,12 +935,12 @@ Apd |void |sv_upgrade |NN SV *const sv|svtype new_type
934935
Apdmb |void |sv_usepvn |NN SV* sv|NULLOK char* ptr|STRLEN len
935936
Apd |void |sv_usepvn_flags|NN SV *const sv|NULLOK char* ptr|const STRLEN len\
936937
|const U32 flags
937-
Apd |void |sv_vcatpvfn |NN SV* sv|NN const char* pat|STRLEN patlen \
938-
|NULLOK va_list* args|NULLOK SV** svargs|I32 svmax \
939-
|NULLOK bool *maybe_tainted
940-
Apd |void |sv_vsetpvfn |NN SV* sv|NN const char* pat|STRLEN patlen \
941-
|NULLOK va_list* args|NULLOK SV** svargs|I32 svmax \
942-
|NULLOK bool *maybe_tainted
938+
Apd |void |sv_vcatpvfn |NN SV *const sv|NN const char *const pat|const STRLEN patlen \
939+
|NULLOK va_list *const args|NULLOK SV **const svargs|const I32 svmax \
940+
|NULLOK bool *const maybe_tainted
941+
Apd |void |sv_vsetpvfn |NN SV *const sv|NN const char *const pat|const STRLEN patlen \
942+
|NULLOK va_list *const args|NULLOK SV **const svargs \
943+
|const I32 svmax|NULLOK bool *const maybe_tainted
943944
ApR |NV |str_to_version |NN SV *sv
944945
Ap |SV* |swash_init |NN const char* pkg|NN const char* name|NN SV* listsv|I32 minbits|I32 none
945946
Ap |UV |swash_fetch |NN SV *swash|NN const U8 *ptr|bool do_utf8
@@ -1032,8 +1033,9 @@ Ap |void |free_global_struct|NN struct perl_vars *plvarsp
10321033
#endif
10331034
Ap |int |runops_standard
10341035
Ap |int |runops_debug
1035-
Afpd |void |sv_catpvf_mg |NN SV *sv|NN const char* pat|...
1036-
Apd |void |sv_vcatpvf_mg |NN SV* sv|NN const char* pat|NULLOK va_list* args
1036+
Afpd |void |sv_catpvf_mg |NN SV *const sv|NN const char *const pat|...
1037+
Apd |void |sv_vcatpvf_mg |NN SV *const sv|NN const char *const pat \
1038+
|NULLOK va_list *const args
10371039
Apd |void |sv_catpv_mg |NN SV *const sv|NULLOK const char *const ptr
10381040
Apdbm |void |sv_catpvn_mg |NN SV *sv|NN const char *ptr|STRLEN len
10391041
Apdbm |void |sv_catsv_mg |NN SV *dsv|NULLOK SV *ssv
@@ -1111,13 +1113,13 @@ ApR |HE* |he_dup |NULLOK const HE* e|bool shared|NN CLONE_PARAMS* param
11111113
ApR |HEK* |hek_dup |NULLOK HEK* e|NN CLONE_PARAMS* param
11121114
Ap |void |re_dup_guts |NN const REGEXP *sstr|NN REGEXP *dstr \
11131115
|NN CLONE_PARAMS* param
1114-
Ap |PerlIO*|fp_dup |NULLOK PerlIO* fp|char type|NN CLONE_PARAMS* param
1115-
ApR |DIR* |dirp_dup |NULLOK DIR* dp
1116-
ApR |GP* |gp_dup |NULLOK GP* gp|NN CLONE_PARAMS* param
1117-
ApR |MAGIC* |mg_dup |NULLOK MAGIC* mg|NN CLONE_PARAMS* param
1116+
Ap |PerlIO*|fp_dup |NULLOK PerlIO *const fp|const char type|NN CLONE_PARAMS *const param
1117+
ApR |DIR* |dirp_dup |NULLOK DIR *const dp
1118+
ApR |GP* |gp_dup |NULLOK GP *const gp|NN CLONE_PARAMS *const param
1119+
ApR |MAGIC* |mg_dup |NULLOK MAGIC *const mg|NN CLONE_PARAMS *const param
11181120
ApR |SV* |sv_dup |NULLOK const SV* sstr|NN CLONE_PARAMS* param
11191121
Ap |void |rvpv_dup |NN SV* dstr|NN const SV *sstr|NN CLONE_PARAMS* param
1120-
Ap |yy_parser*|parser_dup |NULLOK const yy_parser *proto|NN CLONE_PARAMS* param
1122+
Ap |yy_parser*|parser_dup |NULLOK const yy_parser *const proto|NN CLONE_PARAMS *const param
11211123
#endif
11221124
Apa |PTR_TBL_t*|ptr_table_new
11231125
ApR |void* |ptr_table_fetch|NN PTR_TBL_t *tbl|NULLOK const void *sv
@@ -1558,7 +1560,7 @@ s |int |sv_2iuv_non_preserve |NN SV *const sv|I32 numtype
15581560
s |int |sv_2iuv_non_preserve |NN SV *const sv
15591561
# endif
15601562
# endif
1561-
sR |I32 |expect_number |NN char** pattern
1563+
sR |I32 |expect_number |NN char **const pattern
15621564
#
15631565
sn |STRLEN |sv_pos_u2b_forwards|NN const U8 *const start \
15641566
|NN const U8 *const send|STRLEN uoffset
@@ -1571,7 +1573,7 @@ s |void |utf8_mg_pos_cache_update|NN SV *const sv|NN MAGIC **const mgp \
15711573
|const STRLEN byte|const STRLEN utf8|const STRLEN blen
15721574
s |STRLEN |sv_pos_b2u_midway|NN const U8 *const s|NN const U8 *const target \
15731575
|NN const U8 *end|STRLEN endu
1574-
sn |char * |F0convert |NV nv|NN char *endbuf|NN STRLEN *len
1576+
sn |char * |F0convert |NV nv|NN char *const endbuf|NN STRLEN *const len
15751577
# if defined(PERL_OLD_COPY_ON_WRITE)
15761578
sM |void |sv_release_COW |NN SV *sv|NN const char *pvx|NN SV *after
15771579
# endif

pod/perlapi.pod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5488,7 +5488,7 @@ upgraded to UTF-8. Handles 'get' magic, but not 'set' magic. See
54885488
C<sv_catpvf_mg>. If the original SV was UTF-8, the pattern should be
54895489
valid UTF-8; if the original SV was bytes, the pattern should be too.
54905490

5491-
void sv_catpvf(SV* sv, const char* pat, ...)
5491+
void sv_catpvf(SV *const sv, const char *const pat, ...)
54925492

54935493
=for hackers
54945494
Found in file sv.c
@@ -5498,7 +5498,7 @@ X<sv_catpvf_mg>
54985498

54995499
Like C<sv_catpvf>, but also handles 'set' magic.
55005500

5501-
void sv_catpvf_mg(SV *sv, const char* pat, ...)
5501+
void sv_catpvf_mg(SV *const sv, const char *const pat, ...)
55025502

55035503
=for hackers
55045504
Found in file sv.c
@@ -6476,7 +6476,7 @@ to an SV. Does not handle 'set' magic. See C<sv_vcatpvf_mg>.
64766476

64776477
Usually used via its frontend C<sv_catpvf>.
64786478

6479-
void sv_vcatpvf(SV* sv, const char* pat, va_list* args)
6479+
void sv_vcatpvf(SV *const sv, const char *const pat, va_list *const args)
64806480

64816481
=for hackers
64826482
Found in file sv.c
@@ -6492,7 +6492,7 @@ locales).
64926492

64936493
Usually used via one of its frontends C<sv_vcatpvf> and C<sv_vcatpvf_mg>.
64946494

6495-
void sv_vcatpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
6495+
void sv_vcatpvfn(SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted)
64966496

64976497
=for hackers
64986498
Found in file sv.c
@@ -6504,7 +6504,7 @@ Like C<sv_vcatpvf>, but also handles 'set' magic.
65046504

65056505
Usually used via its frontend C<sv_catpvf_mg>.
65066506

6507-
void sv_vcatpvf_mg(SV* sv, const char* pat, va_list* args)
6507+
void sv_vcatpvf_mg(SV *const sv, const char *const pat, va_list *const args)
65086508

65096509
=for hackers
65106510
Found in file sv.c
@@ -6530,7 +6530,7 @@ appending it.
65306530

65316531
Usually used via one of its frontends C<sv_vsetpvf> and C<sv_vsetpvf_mg>.
65326532

6533-
void sv_vsetpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
6533+
void sv_vsetpvfn(SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted)
65346534

65356535
=for hackers
65366536
Found in file sv.c

proto.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,14 +3075,14 @@ PERL_CALLCONV SV* Perl_sv_bless(pTHX_ SV *const sv, HV *const stash)
30753075
#define PERL_ARGS_ASSERT_SV_BLESS \
30763076
assert(sv); assert(stash)
30773077

3078-
PERL_CALLCONV void Perl_sv_catpvf(pTHX_ SV* sv, const char* pat, ...)
3078+
PERL_CALLCONV void Perl_sv_catpvf(pTHX_ SV *const sv, const char *const pat, ...)
30793079
__attribute__format__(__printf__,pTHX_2,pTHX_3)
30803080
__attribute__nonnull__(pTHX_1)
30813081
__attribute__nonnull__(pTHX_2);
30823082
#define PERL_ARGS_ASSERT_SV_CATPVF \
30833083
assert(sv); assert(pat)
30843084

3085-
PERL_CALLCONV void Perl_sv_vcatpvf(pTHX_ SV* sv, const char* pat, va_list* args)
3085+
PERL_CALLCONV void Perl_sv_vcatpvf(pTHX_ SV *const sv, const char *const pat, va_list *const args)
30863086
__attribute__nonnull__(pTHX_1)
30873087
__attribute__nonnull__(pTHX_2);
30883088
#define PERL_ARGS_ASSERT_SV_VCATPVF \
@@ -3390,13 +3390,13 @@ PERL_CALLCONV void Perl_sv_usepvn_flags(pTHX_ SV *const sv, char* ptr, const STR
33903390
#define PERL_ARGS_ASSERT_SV_USEPVN_FLAGS \
33913391
assert(sv)
33923392

3393-
PERL_CALLCONV void Perl_sv_vcatpvfn(pTHX_ SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
3393+
PERL_CALLCONV void Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted)
33943394
__attribute__nonnull__(pTHX_1)
33953395
__attribute__nonnull__(pTHX_2);
33963396
#define PERL_ARGS_ASSERT_SV_VCATPVFN \
33973397
assert(sv); assert(pat)
33983398

3399-
PERL_CALLCONV void Perl_sv_vsetpvfn(pTHX_ SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
3399+
PERL_CALLCONV void Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted)
34003400
__attribute__nonnull__(pTHX_1)
34013401
__attribute__nonnull__(pTHX_2);
34023402
#define PERL_ARGS_ASSERT_SV_VSETPVFN \
@@ -3742,14 +3742,14 @@ PERL_CALLCONV void Perl_free_global_struct(pTHX_ struct perl_vars *plvarsp)
37423742
#endif
37433743
PERL_CALLCONV int Perl_runops_standard(pTHX);
37443744
PERL_CALLCONV int Perl_runops_debug(pTHX);
3745-
PERL_CALLCONV void Perl_sv_catpvf_mg(pTHX_ SV *sv, const char* pat, ...)
3745+
PERL_CALLCONV void Perl_sv_catpvf_mg(pTHX_ SV *const sv, const char *const pat, ...)
37463746
__attribute__format__(__printf__,pTHX_2,pTHX_3)
37473747
__attribute__nonnull__(pTHX_1)
37483748
__attribute__nonnull__(pTHX_2);
37493749
#define PERL_ARGS_ASSERT_SV_CATPVF_MG \
37503750
assert(sv); assert(pat)
37513751

3752-
PERL_CALLCONV void Perl_sv_vcatpvf_mg(pTHX_ SV* sv, const char* pat, va_list* args)
3752+
PERL_CALLCONV void Perl_sv_vcatpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const args)
37533753
__attribute__nonnull__(pTHX_1)
37543754
__attribute__nonnull__(pTHX_2);
37553755
#define PERL_ARGS_ASSERT_SV_VCATPVF_MG \
@@ -4041,21 +4041,21 @@ PERL_CALLCONV void Perl_re_dup_guts(pTHX_ const REGEXP *sstr, REGEXP *dstr, CLON
40414041
#define PERL_ARGS_ASSERT_RE_DUP_GUTS \
40424042
assert(sstr); assert(dstr); assert(param)
40434043

4044-
PERL_CALLCONV PerlIO* Perl_fp_dup(pTHX_ PerlIO* fp, char type, CLONE_PARAMS* param)
4044+
PERL_CALLCONV PerlIO* Perl_fp_dup(pTHX_ PerlIO *const fp, const char type, CLONE_PARAMS *const param)
40454045
__attribute__nonnull__(pTHX_3);
40464046
#define PERL_ARGS_ASSERT_FP_DUP \
40474047
assert(param)
40484048

4049-
PERL_CALLCONV DIR* Perl_dirp_dup(pTHX_ DIR* dp)
4049+
PERL_CALLCONV DIR* Perl_dirp_dup(pTHX_ DIR *const dp)
40504050
__attribute__warn_unused_result__;
40514051

4052-
PERL_CALLCONV GP* Perl_gp_dup(pTHX_ GP* gp, CLONE_PARAMS* param)
4052+
PERL_CALLCONV GP* Perl_gp_dup(pTHX_ GP *const gp, CLONE_PARAMS *const param)
40534053
__attribute__warn_unused_result__
40544054
__attribute__nonnull__(pTHX_2);
40554055
#define PERL_ARGS_ASSERT_GP_DUP \
40564056
assert(param)
40574057

4058-
PERL_CALLCONV MAGIC* Perl_mg_dup(pTHX_ MAGIC* mg, CLONE_PARAMS* param)
4058+
PERL_CALLCONV MAGIC* Perl_mg_dup(pTHX_ MAGIC *const mg, CLONE_PARAMS *const param)
40594059
__attribute__warn_unused_result__
40604060
__attribute__nonnull__(pTHX_2);
40614061
#define PERL_ARGS_ASSERT_MG_DUP \
@@ -4074,7 +4074,7 @@ PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV* dstr, const SV *sstr, CLONE_PARAMS* p
40744074
#define PERL_ARGS_ASSERT_RVPV_DUP \
40754075
assert(dstr); assert(sstr); assert(param)
40764076

4077-
PERL_CALLCONV yy_parser* Perl_parser_dup(pTHX_ const yy_parser *proto, CLONE_PARAMS* param)
4077+
PERL_CALLCONV yy_parser* Perl_parser_dup(pTHX_ const yy_parser *const proto, CLONE_PARAMS *const param)
40784078
__attribute__nonnull__(pTHX_2);
40794079
#define PERL_ARGS_ASSERT_PARSER_DUP \
40804080
assert(param)
@@ -5541,7 +5541,7 @@ STATIC int S_sv_2iuv_non_preserve(pTHX_ SV *const sv)
55415541

55425542
# endif
55435543
# endif
5544-
STATIC I32 S_expect_number(pTHX_ char** pattern)
5544+
STATIC I32 S_expect_number(pTHX_ char **const pattern)
55455545
__attribute__warn_unused_result__
55465546
__attribute__nonnull__(pTHX_1);
55475547
#define PERL_ARGS_ASSERT_EXPECT_NUMBER \
@@ -5581,7 +5581,7 @@ STATIC STRLEN S_sv_pos_b2u_midway(pTHX_ const U8 *const s, const U8 *const targe
55815581
#define PERL_ARGS_ASSERT_SV_POS_B2U_MIDWAY \
55825582
assert(s); assert(target); assert(end)
55835583

5584-
STATIC char * S_F0convert(NV nv, char *endbuf, STRLEN *len)
5584+
STATIC char * S_F0convert(NV nv, char *const endbuf, STRLEN *const len)
55855585
__attribute__nonnull__(2)
55865586
__attribute__nonnull__(3);
55875587
#define PERL_ARGS_ASSERT_F0CONVERT \

sv.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8725,7 +8725,7 @@ valid UTF-8; if the original SV was bytes, the pattern should be too.
87258725
=cut */
87268726

87278727
void
8728-
Perl_sv_catpvf(pTHX_ SV *sv, const char* pat, ...)
8728+
Perl_sv_catpvf(pTHX_ SV *const sv, const char *const pat, ...)
87298729
{
87308730
va_list args;
87318731

@@ -8748,7 +8748,7 @@ Usually used via its frontend C<sv_catpvf>.
87488748
*/
87498749

87508750
void
8751-
Perl_sv_vcatpvf(pTHX_ SV *sv, const char* pat, va_list* args)
8751+
Perl_sv_vcatpvf(pTHX_ SV *const sv, const char *const pat, va_list *const args)
87528752
{
87538753
PERL_ARGS_ASSERT_SV_VCATPVF;
87548754

@@ -8764,7 +8764,7 @@ Like C<sv_catpvf>, but also handles 'set' magic.
87648764
*/
87658765

87668766
void
8767-
Perl_sv_catpvf_mg(pTHX_ SV *sv, const char* pat, ...)
8767+
Perl_sv_catpvf_mg(pTHX_ SV *const sv, const char *const pat, ...)
87688768
{
87698769
va_list args;
87708770

@@ -8786,7 +8786,7 @@ Usually used via its frontend C<sv_catpvf_mg>.
87868786
*/
87878787

87888788
void
8789-
Perl_sv_vcatpvf_mg(pTHX_ SV *sv, const char* pat, va_list* args)
8789+
Perl_sv_vcatpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const args)
87908790
{
87918791
PERL_ARGS_ASSERT_SV_VCATPVF_MG;
87928792

@@ -8806,7 +8806,8 @@ Usually used via one of its frontends C<sv_vsetpvf> and C<sv_vsetpvf_mg>.
88068806
*/
88078807

88088808
void
8809-
Perl_sv_vsetpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, I32 svmax, bool *maybe_tainted)
8809+
Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen,
8810+
va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted)
88108811
{
88118812
PERL_ARGS_ASSERT_SV_VSETPVFN;
88128813

@@ -8815,7 +8816,7 @@ Perl_sv_vsetpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
88158816
}
88168817

88178818
STATIC I32
8818-
S_expect_number(pTHX_ char** pattern)
8819+
S_expect_number(pTHX_ char **const pattern)
88198820
{
88208821
dVAR;
88218822
I32 var = 0;
@@ -8838,7 +8839,7 @@ S_expect_number(pTHX_ char** pattern)
88388839
}
88398840

88408841
STATIC char *
8841-
S_F0convert(NV nv, char *endbuf, STRLEN *len)
8842+
S_F0convert(NV nv, char *const endbuf, STRLEN *const len)
88428843
{
88438844
const int neg = nv < 0;
88448845
UV uv;
@@ -8888,7 +8889,8 @@ Usually used via one of its frontends C<sv_vcatpvf> and C<sv_vcatpvf_mg>.
88888889
/* XXX maybe_tainted is never assigned to, so the doc above is lying. */
88898890

88908891
void
8891-
Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, I32 svmax, bool *maybe_tainted)
8892+
Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen,
8893+
va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted)
88928894
{
88938895
dVAR;
88948896
char *p;
@@ -9997,7 +9999,7 @@ ptr_table_* functions.
99979999
/* clone a parser */
999810000

999910001
yy_parser *
10000-
Perl_parser_dup(pTHX_ const yy_parser *proto, CLONE_PARAMS* param)
10002+
Perl_parser_dup(pTHX_ const yy_parser *const proto, CLONE_PARAMS *const param)
1000110003
{
1000210004
yy_parser *parser;
1000310005

@@ -10140,7 +10142,7 @@ Perl_fp_dup(pTHX_ PerlIO *fp, char type, CLONE_PARAMS *param)
1014010142
/* duplicate a directory handle */
1014110143

1014210144
DIR *
10143-
Perl_dirp_dup(pTHX_ DIR *dp)
10145+
Perl_dirp_dup(pTHX_ DIR *const dp)
1014410146
{
1014510147
PERL_UNUSED_CONTEXT;
1014610148
if (!dp)
@@ -10152,7 +10154,7 @@ Perl_dirp_dup(pTHX_ DIR *dp)
1015210154
/* duplicate a typeglob */
1015310155

1015410156
GP *
10155-
Perl_gp_dup(pTHX_ GP *gp, CLONE_PARAMS* param)
10157+
Perl_gp_dup(pTHX_ GP *const gp, CLONE_PARAMS *const param)
1015610158
{
1015710159
GP *ret;
1015810160

@@ -10187,7 +10189,7 @@ Perl_gp_dup(pTHX_ GP *gp, CLONE_PARAMS* param)
1018710189
/* duplicate a chain of magic */
1018810190

1018910191
MAGIC *
10190-
Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS* param)
10192+
Perl_mg_dup(pTHX_ MAGIC *const mg, CLONE_PARAMS *const param)
1019110193
{
1019210194
MAGIC *mgprev = (MAGIC*)NULL;
1019310195
MAGIC *mgret;

0 commit comments

Comments
 (0)