Prefix all exported symbols with "mop_"
Florian Ragwitz [Tue, 10 Mar 2009 03:44:33 +0000 (04:44 +0100)]
mop.c
mop.h
xs/Class.xs
xs/MOP.xs
xs/Package.xs

diff --git a/mop.c b/mop.c
index 9945d18..688634d 100644 (file)
--- a/mop.c
+++ b/mop.c
@@ -76,7 +76,7 @@ mop_call0 (pTHX_ SV *const self, SV *const method)
 }
 
 int
-get_code_info (SV *coderef, char **pkg, char **name)
+mop_get_code_info (SV *coderef, char **pkg, char **name)
 {
     if (!SvOK(coderef) || !SvROK(coderef) || SvTYPE(SvRV(coderef)) != SVt_PVCV) {
         return 0;
@@ -109,7 +109,7 @@ get_code_info (SV *coderef, char **pkg, char **name)
 }
 
 void
-get_package_symbols (HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud)
+mop_get_package_symbols (HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud)
 {
     HE *he;
 
@@ -195,9 +195,9 @@ collect_all_symbols (const char *key, STRLEN keylen, SV *val, void *ud)
 }
 
 HV *
-get_all_package_symbols (HV *stash, type_filter_t filter)
+mop_get_all_package_symbols (HV *stash, type_filter_t filter)
 {
     HV *ret = newHV ();
-    get_package_symbols (stash, filter, collect_all_symbols, ret);
+    mop_get_package_symbols (stash, filter, collect_all_symbols, ret);
     return ret;
 }
diff --git a/mop.h b/mop.h
index 7373ead..bdbff08 100644 (file)
--- a/mop.h
+++ b/mop.h
@@ -37,12 +37,12 @@ void mop_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *), CV *cv, SV **mark);
     PERL_HASH(hash_##name, #name, sizeof(#name) - 1); \
 } while (0)
 
-extern SV *method_metaclass;
-extern SV *associated_metaclass;
-extern SV *wrap;
+extern SV *mop_method_metaclass;
+extern SV *mop_associated_metaclass;
+extern SV *mop_wrap;
 
 UV mop_check_package_cache_flag(pTHX_ HV *stash);
-int get_code_info (SV *coderef, char **pkg, char **name);
+int mop_get_code_info (SV *coderef, char **pkg, char **name);
 SV *mop_call0(pTHX_ SV *const self, SV *const method);
 
 typedef enum {
@@ -56,7 +56,7 @@ typedef enum {
 
 typedef bool (*get_package_symbols_cb_t) (const char *, STRLEN, SV *, void *);
 
-void get_package_symbols(HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud);
-HV *get_all_package_symbols (HV *stash, type_filter_t filter);
+void mop_get_package_symbols(HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud);
+HV *mop_get_all_package_symbols (HV *stash, type_filter_t filter);
 
 #endif
index 911e97d..c332b89 100644 (file)
@@ -18,7 +18,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas
     HV   *symbols;
     dSP;
 
-    symbols = get_all_package_symbols(stash, TYPE_FILTER_CODE);
+    symbols = mop_get_all_package_symbols(stash, TYPE_FILTER_CODE);
 
     (void)hv_iterinit(symbols);
     while ( (coderef = hv_iternextsv(symbols, &method_name, &method_name_len)) ) {
@@ -28,7 +28,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas
         SV *method_slot;
         SV *method_object;
 
-        if (!get_code_info(coderef, &cvpkg_name, &cv_name)) {
+        if (!mop_get_code_info(coderef, &cvpkg_name, &cv_name)) {
             continue;
         }
 
@@ -47,7 +47,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas
             }
         }
 
-        method_metaclass_name = mop_call0(aTHX_ self, method_metaclass); /* $self->method_metaclass() */
+        method_metaclass_name = mop_call0(aTHX_ self, mop_method_metaclass); /* $self->method_metaclass() */
 
         /*
             $method_object = $method_metaclass->wrap(
@@ -64,7 +64,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas
         EXTEND(SP, 8);
         PUSHs(method_metaclass_name); /* invocant */
         mPUSHs(newRV_inc((SV *)cv));
-        PUSHs(associated_metaclass);
+        PUSHs(mop_associated_metaclass);
         PUSHs(self);
         PUSHs(key_package_name);
         PUSHs(class_name);
@@ -72,7 +72,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas
         mPUSHs(newSVpv(method_name, method_name_len));
         PUTBACK;
 
-        call_sv(wrap, G_SCALAR | G_METHOD);
+        call_sv(mop_wrap, G_SCALAR | G_METHOD);
         SPAGAIN;
         method_object = POPs;
         PUTBACK;
index f0132e9..5168786 100644 (file)
--- a/xs/MOP.xs
+++ b/xs/MOP.xs
@@ -17,9 +17,9 @@ DECLARE_KEY(methods);
 DECLARE_KEY(VERSION);
 DECLARE_KEY(ISA);
 
-SV *method_metaclass;
-SV *associated_metaclass;
-SV *wrap;
+SV *mop_method_metaclass;
+SV *mop_associated_metaclass;
+SV *mop_wrap;
 
 MODULE = Class::MOP   PACKAGE = Class::MOP
 
@@ -35,9 +35,9 @@ BOOT:
     PREHASH_KEY(VERSION);
     PREHASH_KEY_WITH_VALUE(package_cache_flag, "_package_cache_flag");
 
-    method_metaclass     = newSVpvs("method_metaclass");
-    wrap                 = newSVpvs("wrap");
-    associated_metaclass = newSVpvs("associated_metaclass");
+    mop_method_metaclass     = newSVpvs("method_metaclass");
+    mop_wrap                 = newSVpvs("wrap");
+    mop_associated_metaclass = newSVpvs("associated_metaclass");
 
     MOP_CALL_BOOT (boot_Class__MOP__Package);
     MOP_CALL_BOOT (boot_Class__MOP__Class);
@@ -53,7 +53,7 @@ get_code_info(coderef)
         char *pkg  = NULL;
         char *name = NULL;
     PPCODE:
-        if (get_code_info(coderef, &pkg, &name)) {
+        if (mop_get_code_info(coderef, &pkg, &name)) {
             EXTEND(SP, 2);
             PUSHs(newSVpv(pkg, 0));
             PUSHs(newSVpv(name, 0));
@@ -102,7 +102,7 @@ is_class_loaded(klass=&PL_sv_undef)
             }
         }
 
-        get_package_symbols(stash, TYPE_FILTER_CODE, find_method, &found_method);
+        mop_get_package_symbols(stash, TYPE_FILTER_CODE, find_method, &found_method);
         if (found_method) {
             XSRETURN_YES;
         }
index 7bc25ca..9ec195c 100644 (file)
@@ -34,7 +34,7 @@ get_all_package_symbols(self, filter=TYPE_FILTER_NONE)
             XSRETURN_UNDEF;
         }
 
-        symbols = get_all_package_symbols(stash, filter);
+        symbols = mop_get_all_package_symbols(stash, filter);
         PUSHs(sv_2mortal(newRV_noinc((SV *)symbols)));
 
 void