summaryrefslogtreecommitdiff
path: root/ext/mro
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-17 15:24:47 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-17 15:24:47 +0100
commitc9875a611df71a98a3ccc8a0f3989fc29bd48ed8 (patch)
treeca2b8b41cb4d6de8ca041a370a36360229db79d8 /ext/mro
parent19ec6f53213f9991324bf8d63675bf45dc8b0af0 (diff)
downloadperl-c9875a611df71a98a3ccc8a0f3989fc29bd48ed8.tar.gz
In S_mro_get_linear_isa_c3() replace sv_inc() with code for the cases we need.
Diffstat (limited to 'ext/mro')
-rw-r--r--ext/mro/mro.xs12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs
index 69557a67d7..00c960dd22 100644
--- a/ext/mro/mro.xs
+++ b/ext/mro/mro.xs
@@ -158,9 +158,15 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, U32 level)
HE* const he = hv_fetch_ent(tails, seqitem, 1, 0);
if(he) {
SV* const val = HeVAL(he);
- /* This will increment undef to 1, which is what we
- want for a newly created entry. */
- sv_inc(val);
+ /* For 5.8.0 and later, sv_inc() with increment undef to
+ an IV of 1, which is what we want for a newly created
+ entry. However, for 5.6.x it will become an NV of
+ 1.0, which confuses the SvIVX() checks above. */
+ if(SvIOK(val)) {
+ SvIV_set(val, SvIVX(val) + 1);
+ } else {
+ sv_setiv(val, 1);
+ }
}
}
}