summaryrefslogtreecommitdiff
path: root/cv.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-03 12:41:11 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:45:05 -0700
commit2e800d795e15b864092072119d45b4d3b18b4c88 (patch)
tree3a26ed24f78ac44e0583caa579ea9878f1016877 /cv.h
parent6d5c21479838db78689e08afd075ef4e9100ef0d (diff)
downloadperl-2e800d795e15b864092072119d45b4d3b18b4c88.tar.gz
CvNAME_HEK_set
Diffstat (limited to 'cv.h')
-rw-r--r--cv.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/cv.h b/cv.h
index 3d44a73968..5da9a502f5 100644
--- a/cv.h
+++ b/cv.h
@@ -202,6 +202,15 @@ CvNAME_HEK(CV *sv)
? ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv_u.xcv_hek
: 0;
}
+/* This lowers the refernce count of the previous value, but does *not*
+ increment the reference count of the new value. */
+#define CvNAME_HEK_set(cv, hek) ( \
+ CvNAME_HEK((CV *)(cv)) \
+ ? unshare_hek(SvANY((CV *)(cv))->xcv_gv_u.xcv_hek) \
+ : (void)0, \
+ ((XPVCV*)MUTABLE_PTR(SvANY(cv)))->xcv_gv_u.xcv_hek = (hek), \
+ CvNAMED_on(cv) \
+ )
/*
=head1 CV reference counts and CvOUTSIDE