summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Schubiger <schubiger@cpan.org>2008-03-02 18:47:43 +0100
committerSteve Peters <steve@fisharerojo.org>2008-03-02 18:01:44 +0000
commitaf828c019524ef5fdaaaa6e3b76d5e2381d0ae6b (patch)
tree9b19b7bff1903d2fdc5ca2a2e40db0edf1a66a4c
parent48dbb59ed9af112b035bdcc063c1471a22ec25a2 (diff)
downloadperl-af828c019524ef5fdaaaa6e3b76d5e2381d0ae6b.tar.gz
Re: [PATCH] sv.c: consting
Message-ID: <20080302164743.GB10705@refcnt.homeunix.org> p4raw-id: //depot/perl@33409
-rw-r--r--embed.fnc22
-rw-r--r--pod/perlapi.pod14
-rw-r--r--proto.h20
-rw-r--r--sv.c22
4 files changed, 39 insertions, 39 deletions
diff --git a/embed.fnc b/embed.fnc
index 95813b1084..b5459e0e09 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -860,7 +860,7 @@ Amdb |void |sv_catsv |NN SV *dstr|NULLOK SV *sstr
Apd |void |sv_chop |NN SV *const sv|NULLOK const char *const ptr
pd |I32 |sv_clean_all
pd |void |sv_clean_objs
-Apd |void |sv_clear |NN SV* sv
+Apd |void |sv_clear |NN SV *const sv
Apd |I32 |sv_cmp |NULLOK SV* sv1|NULLOK SV* sv2
Apd |I32 |sv_cmp_locale |NULLOK SV* sv1|NULLOK SV* sv2
#if defined(USE_LOCALE_COLLATE)
@@ -874,8 +874,8 @@ Ap |void |sv_dump |NN SV* sv
ApdR |bool |sv_derived_from|NN SV* sv|NN const char *const name
ApdR |bool |sv_does |NN SV* sv|NN const char *const name
Apd |I32 |sv_eq |NULLOK SV* sv1|NULLOK SV* sv2
-Apd |void |sv_free |NULLOK SV* sv
-poMX |void |sv_free2 |NN SV* sv
+Apd |void |sv_free |NULLOK SV *const sv
+poMX |void |sv_free2 |NN SV *const sv
pd |void |sv_free_arenas
Apd |char* |sv_gets |NN SV* sv|NN PerlIO* fp|I32 append
Apd |char* |sv_grow |NN SV *const sv|STRLEN newlen
@@ -884,8 +884,8 @@ Apd |void |sv_insert |NN SV *const bigstr|const STRLEN offset|const STRLEN len \
|NN const char *const little|const STRLEN littlelen
Apd |int |sv_isa |NULLOK SV* sv|NN const char* name
Apd |int |sv_isobject |NULLOK SV* sv
-Apd |STRLEN |sv_len |NULLOK SV* sv
-Apd |STRLEN |sv_len_utf8 |NULLOK SV* sv
+Apd |STRLEN |sv_len |NULLOK SV *const sv
+Apd |STRLEN |sv_len_utf8 |NULLOK SV *const sv
Apd |void |sv_magic |NN SV *const sv|NULLOK SV *const obj|const int how \
|NULLOK const char *const name|I32 namlen
Apd |MAGIC *|sv_magicext |NN SV *const sv|NULLOK SV *const obj|const int how \
@@ -893,9 +893,9 @@ Apd |MAGIC *|sv_magicext |NN SV *const sv|NULLOK SV *const obj|const int how \
|const I32 namlen
ApdaR |SV* |sv_mortalcopy |NULLOK SV* oldsv
ApdR |SV* |sv_newmortal
-Apd |SV* |sv_newref |NULLOK SV* sv
+Apd |SV* |sv_newref |NULLOK SV *const sv
Ap |char* |sv_peek |NULLOK SV* sv
-Apd |void |sv_pos_u2b |NULLOK SV* sv|NN I32* offsetp|NULLOK I32* lenp
+Apd |void |sv_pos_u2b |NULLOK SV *const sv|NN I32 *const offsetp|NULLOK I32 *const lenp
Apd |void |sv_pos_b2u |NULLOK SV* sv|NN I32* offsetp
Amdb |char* |sv_pvn_force |NN SV* sv|NULLOK STRLEN* lp
Apd |char* |sv_pvutf8n_force|NN SV* sv|NULLOK STRLEN* lp
@@ -904,7 +904,7 @@ Apd |char* |sv_recode_to_utf8 |NN SV* sv|NN SV *encoding
Apd |bool |sv_cat_decode |NN SV* dsv|NN SV *encoding|NN SV *ssv|NN int *offset \
|NN char* tstr|int tlen
ApdR |const char* |sv_reftype |NN const SV* sv|int ob
-Apd |void |sv_replace |NN SV* sv|NN SV* nsv
+Apd |void |sv_replace |NN SV *const sv|NN SV *const nsv
Apd |void |sv_report_used
Apd |void |sv_reset |NN const char* s|NULLOK HV* stash
Afpd |void |sv_setpvf |NN SV* sv|NN const char* pat|...
@@ -1559,10 +1559,10 @@ sR |I32 |expect_number |NN char** pattern
sn |STRLEN |sv_pos_u2b_forwards|NN const U8 *const start \
|NN const U8 *const send|STRLEN uoffset
sn |STRLEN |sv_pos_u2b_midway|NN const U8 *const start \
- |NN const U8 *send|STRLEN uoffset|STRLEN uend
-s |STRLEN |sv_pos_u2b_cached|NN SV *sv|NN MAGIC **mgp \
+ |NN const U8 *send|const STRLEN uoffset|const STRLEN uend
+s |STRLEN |sv_pos_u2b_cached|NN SV *const sv|NN MAGIC **const mgp \
|NN const U8 *const start|NN const U8 *const send \
- |STRLEN uoffset|STRLEN uoffset0|STRLEN boffset0
+ |const STRLEN uoffset|STRLEN uoffset0|STRLEN boffset0
s |void |utf8_mg_pos_cache_update|NN SV *sv|NN MAGIC **mgp \
|STRLEN byte|STRLEN utf8|STRLEN blen
s |STRLEN |sv_pos_b2u_midway|NN const U8 *s|NN const U8 *const target \
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index cc2fc738de..cdad9de6e9 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -5602,7 +5602,7 @@ This function should only be called when REFCNT is zero. Most of the time
you'll want to call C<sv_free()> (or its macro wrapper C<SvREFCNT_dec>)
instead.
- void sv_clear(SV* sv)
+ void sv_clear(SV *const sv)
=for hackers
Found in file sv.c
@@ -5712,7 +5712,7 @@ C<sv_clear> to invoke destructors and free up any memory used by
the body; finally, deallocate the SV's head itself.
Normally called via a wrapper macro C<SvREFCNT_dec>.
- void sv_free(SV* sv)
+ void sv_free(SV *const sv)
=for hackers
Found in file sv.c
@@ -5792,7 +5792,7 @@ X<sv_len>
Returns the length of the string in the SV. Handles magic and type
coercion. See also C<SvCUR>, which gives raw access to the xpv_cur slot.
- STRLEN sv_len(SV* sv)
+ STRLEN sv_len(SV *const sv)
=for hackers
Found in file sv.c
@@ -5803,7 +5803,7 @@ X<sv_len_utf8>
Returns the number of characters in the string in an SV, counting wide
UTF-8 bytes as a single character. Handles magic and type coercion.
- STRLEN sv_len_utf8(SV* sv)
+ STRLEN sv_len_utf8(SV *const sv)
=for hackers
Found in file sv.c
@@ -5879,7 +5879,7 @@ X<sv_newref>
Increment an SV's reference count. Use the C<SvREFCNT_inc()> wrapper
instead.
- SV* sv_newref(SV* sv)
+ SV* sv_newref(SV *const sv)
=for hackers
Found in file sv.c
@@ -5905,7 +5905,7 @@ lenp is non-zero, it does the same to lenp, but this time starting from
the offset, rather than from the start of the string. Handles magic and
type coercion.
- void sv_pos_u2b(SV* sv, I32* offsetp, I32* lenp)
+ void sv_pos_u2b(SV *const sv, I32 *const offsetp, I32 *const lenp)
=for hackers
Found in file sv.c
@@ -5977,7 +5977,7 @@ and any magic in the source is discarded.
Note that this is a rather specialist SV copying operation; most of the
time you'll want to use C<sv_setsv> or one of its many macro front-ends.
- void sv_replace(SV* sv, SV* nsv)
+ void sv_replace(SV *const sv, SV *const nsv)
=for hackers
Found in file sv.c
diff --git a/proto.h b/proto.h
index ff28d964bf..d6869ca8c4 100644
--- a/proto.h
+++ b/proto.h
@@ -3114,7 +3114,7 @@ PERL_CALLCONV void Perl_sv_chop(pTHX_ SV *const sv, const char *const ptr)
PERL_CALLCONV I32 Perl_sv_clean_all(pTHX);
PERL_CALLCONV void Perl_sv_clean_objs(pTHX);
-PERL_CALLCONV void Perl_sv_clear(pTHX_ SV* sv)
+PERL_CALLCONV void Perl_sv_clear(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SV_CLEAR \
assert(sv)
@@ -3163,8 +3163,8 @@ PERL_CALLCONV bool Perl_sv_does(pTHX_ SV* sv, const char *const name)
assert(sv); assert(name)
PERL_CALLCONV I32 Perl_sv_eq(pTHX_ SV* sv1, SV* sv2);
-PERL_CALLCONV void Perl_sv_free(pTHX_ SV* sv);
-PERL_CALLCONV void Perl_sv_free2(pTHX_ SV* sv)
+PERL_CALLCONV void Perl_sv_free(pTHX_ SV *const sv);
+PERL_CALLCONV void Perl_sv_free2(pTHX_ SV *const sv)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SV_FREE2 \
assert(sv)
@@ -3194,8 +3194,8 @@ PERL_CALLCONV int Perl_sv_isa(pTHX_ SV* sv, const char* name)
assert(name)
PERL_CALLCONV int Perl_sv_isobject(pTHX_ SV* sv);
-PERL_CALLCONV STRLEN Perl_sv_len(pTHX_ SV* sv);
-PERL_CALLCONV STRLEN Perl_sv_len_utf8(pTHX_ SV* sv);
+PERL_CALLCONV STRLEN Perl_sv_len(pTHX_ SV *const sv);
+PERL_CALLCONV STRLEN Perl_sv_len_utf8(pTHX_ SV *const sv);
PERL_CALLCONV void Perl_sv_magic(pTHX_ SV *const sv, SV *const obj, const int how, const char *const name, I32 namlen)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SV_MAGIC \
@@ -3213,9 +3213,9 @@ PERL_CALLCONV SV* Perl_sv_mortalcopy(pTHX_ SV* oldsv)
PERL_CALLCONV SV* Perl_sv_newmortal(pTHX)
__attribute__warn_unused_result__;
-PERL_CALLCONV SV* Perl_sv_newref(pTHX_ SV* sv);
+PERL_CALLCONV SV* Perl_sv_newref(pTHX_ SV *const sv);
PERL_CALLCONV char* Perl_sv_peek(pTHX_ SV* sv);
-PERL_CALLCONV void Perl_sv_pos_u2b(pTHX_ SV* sv, I32* offsetp, I32* lenp)
+PERL_CALLCONV void Perl_sv_pos_u2b(pTHX_ SV *const sv, I32 *const offsetp, I32 *const lenp)
__attribute__nonnull__(pTHX_2);
#define PERL_ARGS_ASSERT_SV_POS_U2B \
assert(offsetp)
@@ -3261,7 +3261,7 @@ PERL_CALLCONV const char* Perl_sv_reftype(pTHX_ const SV* sv, int ob)
#define PERL_ARGS_ASSERT_SV_REFTYPE \
assert(sv)
-PERL_CALLCONV void Perl_sv_replace(pTHX_ SV* sv, SV* nsv)
+PERL_CALLCONV void Perl_sv_replace(pTHX_ SV *const sv, SV *const nsv)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
#define PERL_ARGS_ASSERT_SV_REPLACE \
@@ -5557,13 +5557,13 @@ STATIC STRLEN S_sv_pos_u2b_forwards(const U8 *const start, const U8 *const send,
#define PERL_ARGS_ASSERT_SV_POS_U2B_FORWARDS \
assert(start); assert(send)
-STATIC STRLEN S_sv_pos_u2b_midway(const U8 *const start, const U8 *send, STRLEN uoffset, STRLEN uend)
+STATIC STRLEN S_sv_pos_u2b_midway(const U8 *const start, const U8 *send, const STRLEN uoffset, const STRLEN uend)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
#define PERL_ARGS_ASSERT_SV_POS_U2B_MIDWAY \
assert(start); assert(send)
-STATIC STRLEN S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const start, const U8 *const send, STRLEN uoffset, STRLEN uoffset0, STRLEN boffset0)
+STATIC STRLEN S_sv_pos_u2b_cached(pTHX_ SV *const sv, MAGIC **const mgp, const U8 *const start, const U8 *const send, const STRLEN uoffset, STRLEN uoffset0, STRLEN boffset0)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3)
diff --git a/sv.c b/sv.c
index cc220164e6..c621b2ab70 100644
--- a/sv.c
+++ b/sv.c
@@ -5240,7 +5240,7 @@ time you'll want to use C<sv_setsv> or one of its many macro front-ends.
*/
void
-Perl_sv_replace(pTHX_ register SV *sv, register SV *nsv)
+Perl_sv_replace(pTHX_ register SV *const sv, register SV *const nsv)
{
dVAR;
const U32 refcnt = SvREFCNT(sv);
@@ -5322,7 +5322,7 @@ instead.
*/
void
-Perl_sv_clear(pTHX_ register SV *sv)
+Perl_sv_clear(pTHX_ register SV *const sv)
{
dVAR;
const U32 type = SvTYPE(sv);
@@ -5546,7 +5546,7 @@ instead.
*/
SV *
-Perl_sv_newref(pTHX_ SV *sv)
+Perl_sv_newref(pTHX_ SV *const sv)
{
PERL_UNUSED_CONTEXT;
if (sv)
@@ -5566,7 +5566,7 @@ Normally called via a wrapper macro C<SvREFCNT_dec>.
*/
void
-Perl_sv_free(pTHX_ SV *sv)
+Perl_sv_free(pTHX_ SV *const sv)
{
dVAR;
if (!sv)
@@ -5614,7 +5614,7 @@ Perl_sv_free(pTHX_ SV *sv)
}
void
-Perl_sv_free2(pTHX_ SV *sv)
+Perl_sv_free2(pTHX_ SV *const sv)
{
dVAR;
@@ -5649,7 +5649,7 @@ coercion. See also C<SvCUR>, which gives raw access to the xpv_cur slot.
*/
STRLEN
-Perl_sv_len(pTHX_ register SV *sv)
+Perl_sv_len(pTHX_ register SV *const sv)
{
STRLEN len;
@@ -5682,7 +5682,7 @@ UTF-8 bytes as a single character. Handles magic and type coercion.
*/
STRLEN
-Perl_sv_len_utf8(pTHX_ register SV *sv)
+Perl_sv_len_utf8(pTHX_ register SV *const sv)
{
if (!sv)
return 0;
@@ -5756,7 +5756,7 @@ S_sv_pos_u2b_forwards(const U8 *const start, const U8 *const send,
the passed in UTF-8 offset. */
static STRLEN
S_sv_pos_u2b_midway(const U8 *const start, const U8 *send,
- STRLEN uoffset, STRLEN uend)
+ const STRLEN uoffset, const STRLEN uend)
{
STRLEN backw = uend - uoffset;
@@ -5786,8 +5786,8 @@ S_sv_pos_u2b_midway(const U8 *const start, const U8 *send,
will be used to reduce the amount of linear searching. The cache will be
created if necessary, and the found value offered to it for update. */
static STRLEN
-S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const start,
- const U8 *const send, STRLEN uoffset,
+S_sv_pos_u2b_cached(pTHX_ SV *const sv, MAGIC **const mgp, const U8 *const start,
+ const U8 *const send, const STRLEN uoffset,
STRLEN uoffset0, STRLEN boffset0)
{
STRLEN boffset = 0; /* Actually always set, but let's keep gcc happy. */
@@ -5907,7 +5907,7 @@ type coercion.
*/
void
-Perl_sv_pos_u2b(pTHX_ register SV *sv, I32* offsetp, I32* lenp)
+Perl_sv_pos_u2b(pTHX_ register SV *const sv, I32 *const offsetp, I32 *const lenp)
{
const U8 *start;
STRLEN len;