From: Steven Schubiger Date: Thu, 13 Mar 2008 17:58:00 +0000 (+0100) Subject: Re: [PATCH] sv.c: consting X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1eb6e4ca6af717a8e689085df3c3d608587b9ac2;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] sv.c: consting Message-ID: <20080313165800.GD31102@refcnt.homeunix.org> p4raw-id: //depot/perl@33561 --- diff --git a/embed.fnc b/embed.fnc index 3b6b938..adbd1b8 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1116,17 +1116,18 @@ Ap |void |re_dup_guts |NN const REGEXP *sstr|NN REGEXP *dstr \ Ap |PerlIO*|fp_dup |NULLOK PerlIO *const fp|const char type|NN CLONE_PARAMS *const param ApR |DIR* |dirp_dup |NULLOK DIR *const dp ApR |GP* |gp_dup |NULLOK GP *const gp|NN CLONE_PARAMS *const param -ApR |MAGIC* |mg_dup |NULLOK MAGIC *mg|NN CLONE_PARAMS *const param -ApR |SV* |sv_dup |NULLOK const SV* sstr|NN CLONE_PARAMS* param -Ap |void |rvpv_dup |NN SV* dstr|NN const SV *sstr|NN CLONE_PARAMS* param +ApR |MAGIC* |mg_dup |NULLOK MAGIC *const mg|NN CLONE_PARAMS *const param +ApR |SV* |sv_dup |NULLOK const SV *const sstr|NN CLONE_PARAMS *const param +Ap |void |rvpv_dup |NN SV *const dstr|NN const SV *const sstr|NN CLONE_PARAMS *const param Ap |yy_parser*|parser_dup |NULLOK const yy_parser *const proto|NN CLONE_PARAMS *const param #endif Apa |PTR_TBL_t*|ptr_table_new -ApR |void* |ptr_table_fetch|NN PTR_TBL_t *tbl|NULLOK const void *sv -Ap |void |ptr_table_store|NN PTR_TBL_t *tbl|NULLOK const void *oldsv|NN void *newsv -Ap |void |ptr_table_split|NN PTR_TBL_t *tbl -Ap |void |ptr_table_clear|NULLOK PTR_TBL_t *tbl -Ap |void |ptr_table_free|NULLOK PTR_TBL_t *tbl +ApR |void* |ptr_table_fetch|NN PTR_TBL_t *const tbl|NULLOK const void *const sv +Ap |void |ptr_table_store|NN PTR_TBL_t *const tbl|NULLOK const void *const oldsv \ + |NN void *const newsv +Ap |void |ptr_table_split|NN PTR_TBL_t *const tbl +Ap |void |ptr_table_clear|NULLOK PTR_TBL_t *const tbl +Ap |void |ptr_table_free|NULLOK PTR_TBL_t *const tbl #if defined(USE_ITHREADS) # if defined(HAVE_INTERP_INTERN) Ap |void |sys_intern_dup |NN struct interp_intern* src|NN struct interp_intern* dst @@ -1583,7 +1584,7 @@ s |bool |sv_2iuv_common |NN SV *const sv s |void |glob_assign_glob|NN SV *const dstr|NN SV *const sstr \ |const int dtype s |void |glob_assign_ref|NN SV *const dstr|NN SV *const sstr -sRn |PTR_TBL_ENT_t *|ptr_table_find|NN PTR_TBL_t *tbl|NULLOK const void *sv +sRn |PTR_TBL_ENT_t *|ptr_table_find|NN PTR_TBL_t *const tbl|NULLOK const void *const sv #endif #if defined(PERL_IN_TOKE_C) || defined(PERL_DECL_PROT) diff --git a/proto.h b/proto.h index 9699ccc..cd2e777 100644 --- a/proto.h +++ b/proto.h @@ -4055,19 +4055,19 @@ PERL_CALLCONV GP* Perl_gp_dup(pTHX_ GP *const gp, CLONE_PARAMS *const param) #define PERL_ARGS_ASSERT_GP_DUP \ assert(param) -PERL_CALLCONV MAGIC* Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *const param) +PERL_CALLCONV MAGIC* Perl_mg_dup(pTHX_ MAGIC *const mg, CLONE_PARAMS *const param) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_MG_DUP \ assert(param) -PERL_CALLCONV SV* Perl_sv_dup(pTHX_ const SV* sstr, CLONE_PARAMS* param) +PERL_CALLCONV SV* Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_SV_DUP \ assert(param) -PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV* dstr, const SV *sstr, CLONE_PARAMS* param) +PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV *const dstr, const SV *const sstr, CLONE_PARAMS *const param) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -4084,25 +4084,25 @@ PERL_CALLCONV PTR_TBL_t* Perl_ptr_table_new(pTHX) __attribute__malloc__ __attribute__warn_unused_result__; -PERL_CALLCONV void* Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, const void *sv) +PERL_CALLCONV void* Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *const tbl, const void *const sv) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_PTR_TABLE_FETCH \ assert(tbl) -PERL_CALLCONV void Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldsv, void *newsv) +PERL_CALLCONV void Perl_ptr_table_store(pTHX_ PTR_TBL_t *const tbl, const void *const oldsv, void *const newsv) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_PTR_TABLE_STORE \ assert(tbl); assert(newsv) -PERL_CALLCONV void Perl_ptr_table_split(pTHX_ PTR_TBL_t *tbl) +PERL_CALLCONV void Perl_ptr_table_split(pTHX_ PTR_TBL_t *const tbl) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_PTR_TABLE_SPLIT \ assert(tbl) -PERL_CALLCONV void Perl_ptr_table_clear(pTHX_ PTR_TBL_t *tbl); -PERL_CALLCONV void Perl_ptr_table_free(pTHX_ PTR_TBL_t *tbl); +PERL_CALLCONV void Perl_ptr_table_clear(pTHX_ PTR_TBL_t *const tbl); +PERL_CALLCONV void Perl_ptr_table_free(pTHX_ PTR_TBL_t *const tbl); #if defined(USE_ITHREADS) # if defined(HAVE_INTERP_INTERN) PERL_CALLCONV void Perl_sys_intern_dup(pTHX_ struct interp_intern* src, struct interp_intern* dst) @@ -5615,7 +5615,7 @@ STATIC void S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) #define PERL_ARGS_ASSERT_GLOB_ASSIGN_REF \ assert(dstr); assert(sstr) -STATIC PTR_TBL_ENT_t * S_ptr_table_find(PTR_TBL_t *tbl, const void *sv) +STATIC PTR_TBL_ENT_t * S_ptr_table_find(PTR_TBL_t *const tbl, const void *const sv) __attribute__warn_unused_result__ __attribute__nonnull__(1); #define PERL_ARGS_ASSERT_PTR_TABLE_FIND \ diff --git a/sv.c b/sv.c index 603cb3b..6e9e8e7 100644 --- a/sv.c +++ b/sv.c @@ -10189,7 +10189,7 @@ Perl_gp_dup(pTHX_ GP *const gp, CLONE_PARAMS *const param) /* duplicate a chain of magic */ MAGIC * -Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *const param) +Perl_mg_dup(pTHX_ MAGIC *const mg, CLONE_PARAMS *const param) { MAGIC *mgprev = (MAGIC*)NULL; MAGIC *mgret; @@ -10288,7 +10288,7 @@ Perl_ptr_table_new(pTHX) /* map an existing pointer using a table */ STATIC PTR_TBL_ENT_t * -S_ptr_table_find(PTR_TBL_t *tbl, const void *sv) +S_ptr_table_find(PTR_TBL_t *const tbl, const void *const sv) { PTR_TBL_ENT_t *tblent; const UV hash = PTR_TABLE_HASH(sv); @@ -10304,7 +10304,7 @@ S_ptr_table_find(PTR_TBL_t *tbl, const void *sv) } void * -Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, const void *sv) +Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *const tbl, const void *const sv) { PTR_TBL_ENT_t const *const tblent = ptr_table_find(tbl, sv); @@ -10317,7 +10317,7 @@ Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, const void *sv) /* add a new entry to a pointer-mapping table */ void -Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldsv, void *newsv) +Perl_ptr_table_store(pTHX_ PTR_TBL_t *const tbl, const void *const oldsv, void *const newsv) { PTR_TBL_ENT_t *tblent = ptr_table_find(tbl, oldsv); @@ -10344,7 +10344,7 @@ Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldsv, void *newsv) /* double the hash bucket size of an existing ptr table */ void -Perl_ptr_table_split(pTHX_ PTR_TBL_t *tbl) +Perl_ptr_table_split(pTHX_ PTR_TBL_t *const tbl) { PTR_TBL_ENT_t **ary = tbl->tbl_ary; const UV oldsize = tbl->tbl_max + 1; @@ -10379,7 +10379,7 @@ Perl_ptr_table_split(pTHX_ PTR_TBL_t *tbl) /* remove all the entries from a ptr table */ void -Perl_ptr_table_clear(pTHX_ PTR_TBL_t *tbl) +Perl_ptr_table_clear(pTHX_ PTR_TBL_t *const tbl) { if (tbl && tbl->tbl_items) { register PTR_TBL_ENT_t * const * const array = tbl->tbl_ary; @@ -10402,7 +10402,7 @@ Perl_ptr_table_clear(pTHX_ PTR_TBL_t *tbl) /* clear and free a ptr table */ void -Perl_ptr_table_free(pTHX_ PTR_TBL_t *tbl) +Perl_ptr_table_free(pTHX_ PTR_TBL_t *const tbl) { if (!tbl) { return; @@ -10415,7 +10415,7 @@ Perl_ptr_table_free(pTHX_ PTR_TBL_t *tbl) #if defined(USE_ITHREADS) void -Perl_rvpv_dup(pTHX_ SV *dstr, const SV *sstr, CLONE_PARAMS* param) +Perl_rvpv_dup(pTHX_ SV *const dstr, const SV *const sstr, CLONE_PARAMS *const param) { PERL_ARGS_ASSERT_RVPV_DUP; @@ -10463,7 +10463,7 @@ Perl_rvpv_dup(pTHX_ SV *dstr, const SV *sstr, CLONE_PARAMS* param) /* duplicate an SV of any type (including AV, HV etc) */ SV * -Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param) +Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) { dVAR; SV *dstr;