Author: timbo
Date: Mon Feb 13 09:46:47 2012
New Revision: 15147

Modified:
   dbi/trunk/DBI.xs

Log:
HvMROMETA workaround for 5.10.0 (Dave Mitchell)

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Mon Feb 13 09:46:47 2012
@@ -29,6 +29,20 @@
 
 #define DBI_MAGIC '~'
 
+/* HvMROMETA introduced in 5.9.5, but mro_meta_init not exported in 5.10.0 */
+#if (PERL_VERSION < 10)
+#  define MY_cache_gen(stash) 0
+#else
+#  if ((PERL_VERSION == 10) && (PERL_SUBVERSION == 0))
+#    define MY_cache_gen(stash) \
+        (HvAUX(stash)->xhv_mro_meta \
+        ? HvAUX(stash)->xhv_mro_meta->cache_gen \
+        : 0)
+#  else
+#    define MY_cache_gen(stash) HvMROMETA(stash)->cache_gen
+#  endif
+#endif
+
 /* If the tests fail with errors about 'setlinebuf' then try    */
 /* deleting the lines in the block below except the setvbuf one */
 #ifndef PerlIO_setlinebuf
@@ -234,10 +248,7 @@
 
         if (  (c=(method_cache_t *)(mg->mg_ptr))
             && c->stash == stash
-            && c->generation == PL_sub_generation
-#ifdef HvMROMETA /*introduced in 5.9.5 */
-                + HvMROMETA(stash)->cache_gen
-#endif
+            && c->generation == PL_sub_generation + MY_cache_gen(stash)
         )
             return c->gv;
 
@@ -265,11 +276,7 @@
     SvREFCNT_inc(gv);
     c->stash = stash;
     c->gv    = gv;
-    c->generation = PL_sub_generation
-#ifdef HvMROMETA
-            + HvMROMETA(stash)->cache_gen
-#endif
-    ;
+    c->generation = PL_sub_generation + MY_cache_gen(stash);
     return gv;
 }
 

Reply via email to