|NN SV *const data
Aop |const struct mro_alg *|mro_get_from_name|NN SV *name
Aop |void |mro_register |NN const struct mro_alg *mro
+Aop |void |mro_set_mro |NN struct mro_meta *const meta \
+ |NN SV *const name
: Used in HvMROMETA(), which is public.
Xpo |struct mro_meta* |mro_meta_init |NN HV* stash
#if defined(USE_ITHREADS)
}
}
+void
+Perl_mro_set_mro(pTHX_ struct mro_meta *const meta, SV *const name)
+{
+ const struct mro_alg *const which = Perl_mro_get_from_name(aTHX_ name);
+
+ PERL_ARGS_ASSERT_MRO_SET_MRO;
+
+ if (!which)
+ Perl_croak(aTHX_ "Invalid mro name: '%"SVf"'", name);
+
+ if(meta->mro_which != which) {
+ if (meta->mro_linear_c3 && !meta->mro_linear_dfs) {
+ /* If we were storing something directly, put it in the hash before
+ we lose it. */
+ Perl_mro_set_private_data(aTHX_ meta, meta->mro_which,
+ MUTABLE_SV(meta->mro_linear_c3));
+ }
+ meta->mro_which = which;
+ /* Scrub our cached pointer to the private data. */
+ meta->mro_linear_c3 = NULL;
+ /* Only affects local method cache, not
+ even child classes */
+ meta->cache_gen++;
+ if(meta->mro_nextmethod)
+ hv_clear(meta->mro_nextmethod);
+ }
+}
+
#include "XSUB.h"
XS(XS_mro_get_linear_isa);
dVAR;
dXSARGS;
SV* classname;
- const struct mro_alg *which;
HV* class_stash;
struct mro_meta* meta;
if(!class_stash) Perl_croak(aTHX_ "Cannot create class: '%"SVf"'!", SVfARG(classname));
meta = HvMROMETA(class_stash);
- which = Perl_mro_get_from_name(aTHX_ ST(1));
- if (!which)
- Perl_croak(aTHX_ "Invalid mro name: '%"SVf"'", ST(1));
-
- if(meta->mro_which != which) {
- if (meta->mro_linear_c3 && !meta->mro_linear_dfs) {
- /* If we were storing something directly, put it in the hash before
- we lose it. */
- Perl_mro_set_private_data(aTHX_ meta, meta->mro_which,
- MUTABLE_SV(meta->mro_linear_c3));
- }
- meta->mro_which = which;
- /* Scrub our cached pointer to the private data. */
- meta->mro_linear_c3 = NULL;
- /* Only affects local method cache, not
- even child classes */
- meta->cache_gen++;
- if(meta->mro_nextmethod)
- hv_clear(meta->mro_nextmethod);
- }
+ Perl_mro_set_mro(aTHX_ meta, ST(1));
XSRETURN_EMPTY;
}
#define PERL_ARGS_ASSERT_MRO_REGISTER \
assert(mro)
+PERL_CALLCONV void Perl_mro_set_mro(pTHX_ struct mro_meta *const meta, SV *const name)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_MRO_SET_MRO \
+ assert(meta); assert(name)
+
PERL_CALLCONV struct mro_meta* Perl_mro_meta_init(pTHX_ HV* stash)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_MRO_META_INIT \