summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-07-29 13:55:39 +0100
committerDavid Mitchell <davem@iabyn.com>2010-07-29 13:55:39 +0100
commitcef0c2ea80abedd0fa6d0e228f3bf5b8bc3d2903 (patch)
tree0ecb15f59550e91cd5f3253d83003cc845101802 /sv.c
parent09aad8f0e83a4c56d98266fa1ae5deee23229182 (diff)
downloadperl-cef0c2ea80abedd0fa6d0e228f3bf5b8bc3d2903.tar.gz
re-apply some xhv_backreferences notes and stuff
re-apply some of the small doc fixes and a couple of minor code tweaks that were part of the reverted commit 044d8c24fa9214cf0fe9c6fc8a44e03f3f5374d7, but which didn't need reverting
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sv.c b/sv.c
index 4e348a66b7..0f91734f8c 100644
--- a/sv.c
+++ b/sv.c
@@ -5314,13 +5314,13 @@ Perl_sv_rvweaken(pTHX_ SV *const sv)
* structure, from the xhv_backreferences field. (A HV without hv_aux will
* have the standard magic instead.) The array is created with a refcount
* of 2. This means that if during global destruction the array gets
- * picked on first to have its refcount decremented by the random zapper,
- * it won't actually be freed, meaning it's still theere for when its
- * parent gets freed.
+ * picked on before its parent to have its refcount decremented by the
+ * random zapper, it won't actually be freed, meaning it's still there for
+ * when its parent gets freed.
* When the parent SV is freed, in the case of magic, the magic is freed,
* Perl_magic_killbackrefs is called which decrements one refcount, then
* mg_obj is freed which kills the second count.
- * In the vase of a HV being freed, one ref is removed by
+ * In the case of an HV being freed, one ref is removed by
* Perl_hv_kill_backrefs, the other by Perl_sv_kill_backrefs, which it
* calls.
*/
@@ -5435,10 +5435,10 @@ Perl_sv_kill_backrefs(pTHX_ SV *const sv, AV *const av)
PERL_ARGS_ASSERT_SV_KILL_BACKREFS;
- assert(!svp || !SvIS_FREED(av));
if (svp) {
SV *const *const last = svp + AvFILLp(av);
+ assert(!SvIS_FREED(av));
while (svp <= last) {
if (*svp) {
SV *const referrer = *svp;
@@ -5483,6 +5483,7 @@ Perl_sv_kill_backrefs(pTHX_ SV *const sv, AV *const av)
}
svp++;
}
+ AvFILLp(av) = -1;
}
SvREFCNT_dec(av); /* remove extra count added by sv_add_backref() */
return 0;