In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/566771cc1208eb7c5c8363435c4bd1299f0ae5e5?hp=1dffc4d1a24556f4e23f612d6713492847ff064b>
- Log ----------------------------------------------------------------- commit 566771cc1208eb7c5c8363435c4bd1299f0ae5e5 Author: Nicholas Clark <[email protected]> Date: Mon May 4 18:53:39 2009 +0100 Make Perl_hek_dup() cope with a NULL "source" parameter (by returning NULL). Change its callers to take advantage of this. ----------------------------------------------------------------------- Summary of changes: hv.c | 6 +++++- sv.c | 7 +++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hv.c b/hv.c index 79f5973..e3dee46 100644 --- a/hv.c +++ b/hv.c @@ -134,11 +134,15 @@ Perl_free_tied_hv_pool(pTHX) HEK * Perl_hek_dup(pTHX_ HEK *source, CLONE_PARAMS* param) { - HEK *shared = (HEK*)ptr_table_fetch(PL_ptr_table, source); + HEK *shared; PERL_ARGS_ASSERT_HEK_DUP; PERL_UNUSED_ARG(param); + if (!source) + return NULL; + + shared = (HEK*)ptr_table_fetch(PL_ptr_table, source); if (shared) { /* We already shared this hash key. */ (void)share_hek_hek(shared); diff --git a/sv.c b/sv.c index b13985b..9d6fddf 100644 --- a/sv.c +++ b/sv.c @@ -10505,7 +10505,7 @@ Perl_gp_dup(pTHX_ GP *const gp, CLONE_PARAMS *const param) ret->gp_cv = cv_dup_inc(gp->gp_cv, param); ret->gp_cvgen = gp->gp_cvgen; ret->gp_line = gp->gp_line; - ret->gp_file_hek = gp->gp_file_hek ? hek_dup(gp->gp_file_hek, param) : NULL; + ret->gp_file_hek = hek_dup(gp->gp_file_hek, param); return ret; } @@ -10954,8 +10954,7 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) LvTARG(dstr) = sv_dup_inc(LvTARG(dstr), param); case SVt_PVGV: if(isGV_with_GP(sstr)) { - if (GvNAME_HEK(dstr)) - GvNAME_HEK(dstr) = hek_dup(GvNAME_HEK(dstr), param); + GvNAME_HEK(dstr) = hek_dup(GvNAME_HEK(dstr), param); /* Don't call sv_add_backref here as it's going to be created as part of the magic cloning of the symbol table. */ @@ -11053,7 +11052,7 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) SvFLAGS(dstr) |= SVf_OOK; hvname = saux->xhv_name; - daux->xhv_name = hvname ? hek_dup(hvname, param) : hvname; + daux->xhv_name = hek_dup(hvname, param); daux->xhv_riter = saux->xhv_riter; daux->xhv_eiter = saux->xhv_eiter -- Perl5 Master Repository
