From: Andy Lester Date: Thu, 29 Dec 2005 01:15:09 +0000 (-0600) Subject: Actual real consting of parms X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb86f8b30b3c669d547a1d9008e5860ab483ae2d;p=p5sagit%2Fp5-mst-13.2.git Actual real consting of parms Message-ID: <20051229071509.GA32653@petdance.com> p4raw-id: //depot/perl@26527 --- diff --git a/embed.fnc b/embed.fnc index 45f3a92..4b37eac 100644 --- a/embed.fnc +++ b/embed.fnc @@ -985,8 +985,8 @@ Apa |PerlIO*|fp_dup |NULLOK PerlIO* fp|char type|NN CLONE_PARAMS* param Apa |DIR* |dirp_dup |NULLOK DIR* dp Apa |GP* |gp_dup |NULLOK GP* gp|NN CLONE_PARAMS* param Apa |MAGIC* |mg_dup |NULLOK MAGIC* mg|NN CLONE_PARAMS* param -Apa |SV* |sv_dup |NULLOK SV* sstr|NN CLONE_PARAMS* param -Ap |void |rvpv_dup |NN SV* dstr|NN SV *sstr|NN CLONE_PARAMS* param +Apa |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 Apa |PTR_TBL_t*|ptr_table_new Apa |void* |ptr_table_fetch|NN PTR_TBL_t *tbl|NN const void *sv Ap |void |ptr_table_store|NN PTR_TBL_t *tbl|NULLOK const void *oldsv|NN void *newsv diff --git a/proto.h b/proto.h index 3a265d7..4c53afb 100644 --- a/proto.h +++ b/proto.h @@ -2765,12 +2765,12 @@ PERL_CALLCONV MAGIC* Perl_mg_dup(pTHX_ MAGIC* mg, CLONE_PARAMS* param) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_2); -PERL_CALLCONV SV* Perl_sv_dup(pTHX_ SV* sstr, CLONE_PARAMS* param) +PERL_CALLCONV SV* Perl_sv_dup(pTHX_ const SV* sstr, CLONE_PARAMS* param) __attribute__malloc__ __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_2); -PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV* dstr, SV *sstr, CLONE_PARAMS* param) +PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV* dstr, const SV *sstr, CLONE_PARAMS* param) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); diff --git a/sv.c b/sv.c index 781222e..8f3e9cd 100644 --- a/sv.c +++ b/sv.c @@ -9179,7 +9179,7 @@ Perl_ptr_table_free(pTHX_ PTR_TBL_t *tbl) void -Perl_rvpv_dup(pTHX_ SV *dstr, SV *sstr, CLONE_PARAMS* param) +Perl_rvpv_dup(pTHX_ SV *dstr, const SV *sstr, CLONE_PARAMS* param) { if (SvROK(sstr)) { SvRV_set(dstr, SvWEAKREF(sstr) @@ -9225,7 +9225,7 @@ Perl_rvpv_dup(pTHX_ SV *dstr, SV *sstr, CLONE_PARAMS* param) /* duplicate an SV of any type (including AV, HV etc) */ SV * -Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) +Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param) { dVAR; SV *dstr; @@ -9240,12 +9240,11 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) if(param->flags & CLONEf_JOIN_IN) { /** We are joining here so we don't want do clone something that is bad **/ - const char *hvname; - - if(SvTYPE(sstr) == SVt_PVHV && - (hvname = HvNAME_get(sstr))) { - /** don't clone stashes if they already exist **/ - return (SV*)gv_stashpv(hvname,0); + if (SvTYPE(sstr) == SVt_PVHV) { + const char * const hvname = HvNAME_get(sstr); + if (hvname) + /** don't clone stashes if they already exist **/ + return (SV*)gv_stashpv(hvname,0); } }