diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-05-18 11:57:38 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-05-18 11:57:38 +0100 |
commit | 0228edf6a59a23f00e0f6eb4247cc4879f6bd150 (patch) | |
tree | bc9094abde9e7f7af7f0e038adb4c1814b6cf207 /sv.c | |
parent | c160a1863eed093c75031c8196f07c0f13df1789 (diff) | |
download | perl-0228edf6a59a23f00e0f6eb4247cc4879f6bd150.tar.gz |
In Perl_mg_dup(), remove a branch by tracking the address to write to instead of
the address of the structure, with a special case for the first time round.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -10509,18 +10509,17 @@ Perl_gp_dup(pTHX_ GP *const gp, CLONE_PARAMS *const param) MAGIC * Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *const param) { - MAGIC *mgprev = (MAGIC*)NULL; MAGIC *mgret = NULL; + MAGIC **mgprev_p = &mgret; PERL_ARGS_ASSERT_MG_DUP; for (; mg; mg = mg->mg_moremagic) { MAGIC *nmg; Newxz(nmg, 1, MAGIC); - if (mgprev) - mgprev->mg_moremagic = nmg; - else - mgret = nmg; + *mgprev_p = nmg; + mgprev_p = &(nmg->mg_moremagic); + nmg->mg_virtual = mg->mg_virtual; /* XXX copy dynamic vtable? */ nmg->mg_private = mg->mg_private; nmg->mg_type = mg->mg_type; @@ -10564,7 +10563,6 @@ Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *const param) if ((mg->mg_flags & MGf_DUP) && mg->mg_virtual && mg->mg_virtual->svt_dup) { CALL_FPTR(nmg->mg_virtual->svt_dup)(aTHX_ nmg, param); } - mgprev = nmg; } return mgret; } |