when checking @ISA to see if a class is loaded, make sure it actually has values...
[gitmo/Class-MOP.git] / xs / MOP.xs
index f3a6384..cf07b55 100644 (file)
--- a/xs/MOP.xs
+++ b/xs/MOP.xs
@@ -1,16 +1,24 @@
 #include "mop.h"
 
+SV *mop_method_metaclass;
+SV *mop_associated_metaclass;
+SV *mop_wrap;
+
 static bool
 find_method (const char *key, STRLEN keylen, SV *val, void *ud)
 {
     bool *found_method = (bool *)ud;
+    PERL_UNUSED_ARG(key);
+    PERL_UNUSED_ARG(keylen);
+    PERL_UNUSED_ARG(val);
     *found_method = TRUE;
     return FALSE;
 }
 
-SV *mop_method_metaclass;
-SV *mop_associated_metaclass;
-SV *mop_wrap;
+EXTERN_C XS(boot_Class__MOP__Package);
+EXTERN_C XS(boot_Class__MOP__Class);
+EXTERN_C XS(boot_Class__MOP__Attribute);
+EXTERN_C XS(boot_Class__MOP__Method);
 
 MODULE = Class::MOP   PACKAGE = Class::MOP
 
@@ -81,7 +89,7 @@ is_class_loaded(klass=&PL_sv_undef)
 
         if (hv_exists_ent (stash, KEY_FOR(ISA), HASH_FOR(ISA))) {
             HE *isa = hv_fetch_ent(stash, KEY_FOR(ISA), 0, HASH_FOR(ISA));
-            if (isa && HeVAL(isa) && GvAV(HeVAL(isa))) {
+            if (isa && HeVAL(isa) && GvAV(HeVAL(isa)) && av_len(GvAV(HeVAL(isa))) != -1) {
                 XSRETURN_YES;
             }
         }