X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FClass-C3-XS.git;a=blobdiff_plain;f=XS.xs;fp=XS.xs;h=27de74240cc7ad3ebec1671c702c88cf70e81dfc;hp=4ced6b89dc389ae99d75de5c7278365b613e8767;hb=8e1946dc03a4fbfda0401b5699ea2c06c57e3a6f;hpb=aaef7ce9db4806285212b0a5ce8341cf9b9be64a diff --git a/XS.xs b/XS.xs index 4ced6b8..27de742 100644 --- a/XS.xs +++ b/XS.xs @@ -189,9 +189,15 @@ __mro_linear_isa_c3(pTHX_ HV* stash, HV* cache, I32 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)) { + SvIVX(val)++; + } else { + sv_setiv(val, 1); + } } else { croak("failed to store value in hash"); }