summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-11-22 19:18:57 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-11-23 12:26:41 -0800
commitb99c9e9a2fb2fff6d70f66d59c376cf258e2c047 (patch)
treef2a0fcf0408a8069e2dd165521d1b83a73f68107
parent4b748257c65d0cf78771db569a081f98eb77c7fa (diff)
downloadperl-b99c9e9a2fb2fff6d70f66d59c376cf258e2c047.tar.gz
sv.c:S_curse: move assertions to make them useful
I added these when debugging something, and decided to keep them, as they could be useful. So I committed them as 14eebc59. But now I realise that they are quite useless where they are, as a program will crash before the failed assertions are reached.
-rw-r--r--sv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 9aa2224c42..6a6de93d78 100644
--- a/sv.c
+++ b/sv.c
@@ -6333,9 +6333,9 @@ S_curse(pTHX_ SV * const sv, const bool check_refcnt) {
HV* stash;
do {
stash = SvSTASH(sv);
+ assert(SvTYPE(stash) == SVt_PVHV);
if (HvNAME(stash)) {
CV* destructor = NULL;
- assert(SvTYPE(stash) == SVt_PVHV);
if (!SvOBJECT(stash)) destructor = (CV *)SvSTASH(stash);
if (!destructor) {
GV * const gv =
@@ -6345,6 +6345,8 @@ S_curse(pTHX_ SV * const sv, const bool check_refcnt) {
SvSTASH(stash) =
destructor ? (HV *)destructor : ((HV *)0)+1;
}
+ assert(!destructor || destructor == ((CV *)0)+1
+ || SvTYPE(destructor) == SVt_PVCV);
if (destructor && destructor != ((CV *)0)+1
/* A constant subroutine can have no side effects, so
don't bother calling it. */
@@ -6364,7 +6366,6 @@ S_curse(pTHX_ SV * const sv, const bool check_refcnt) {
)
{
SV* const tmpref = newRV(sv);
- assert(SvTYPE(destructor) == SVt_PVCV);
SvREADONLY_on(tmpref); /* DESTROY() could be naughty */
ENTER;
PUSHSTACKi(PERLSI_DESTROY);