summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-09-04 11:54:06 +0200
committerNicholas Clark <nick@ccl4.org>2012-09-04 11:54:06 +0200
commitf3e2910579399afd7e086e660f40c5b6793d30a8 (patch)
tree05c335d08b6bdeccc038624e03bcbd424d55eb85 /pad.c
parent7bbbc3c08a8830fe5d44ce7a6056cfba6fb67c22 (diff)
downloadperl-f3e2910579399afd7e086e660f40c5b6793d30a8.tar.gz
In Perl_cv_forget_slab(), simplify the conditionally compiled code.
This refactoring reduces the line count and makes it clear that the basic logic is the same with or without -DPERL_DEBUG_READONLY_OPS. It make no change to the generated assembler on a normal build.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/pad.c b/pad.c
index 148fdf8e8c..aba463b26a 100644
--- a/pad.c
+++ b/pad.c
@@ -505,9 +505,7 @@ void
Perl_cv_forget_slab(pTHX_ CV *cv)
{
const bool slabbed = !!CvSLABBED(cv);
-#ifdef PERL_DEBUG_READONLY_OPS
OPSLAB *slab = NULL;
-#endif
PERL_ARGS_ASSERT_CV_FORGET_SLAB;
@@ -515,25 +513,21 @@ Perl_cv_forget_slab(pTHX_ CV *cv)
CvSLABBED_off(cv);
-#ifdef PERL_DEBUG_READONLY_OPS
if (CvROOT(cv)) slab = OpSLAB(CvROOT(cv));
else if (CvSTART(cv)) slab = (OPSLAB *)CvSTART(cv);
-#else
- if (CvROOT(cv)) OpslabREFCNT_dec(OpSLAB(CvROOT(cv)));
- else if (CvSTART(cv)) OpslabREFCNT_dec((OPSLAB *)CvSTART(cv));
-#endif
#ifdef DEBUGGING
else if (slabbed) Perl_warn(aTHX_ "Slab leaked from cv %p", cv);
#endif
-#ifdef PERL_DEBUG_READONLY_OPS
if (slab) {
- size_t refcnt;
- refcnt = slab->opslab_refcnt;
+#ifdef PERL_DEBUG_READONLY_OPS
+ const size_t refcnt = slab->opslab_refcnt;
+#endif
OpslabREFCNT_dec(slab);
+#ifdef PERL_DEBUG_READONLY_OPS
if (refcnt > 1) Slab_to_ro(slab);
- }
#endif
+ }
}
/*