From: Vincent Pit Date: Wed, 26 Oct 2011 15:57:32 +0000 (+0200) Subject: Reorder some code X-Git-Tag: v0.47~10 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=commitdiff_plain;h=29e8c8145c52480bce0b83e2b1971d40dc203a7d Reorder some code --- diff --git a/Magic.xs b/Magic.xs index 5d9c81f..0d17eef 100644 --- a/Magic.xs +++ b/Magic.xs @@ -396,6 +396,16 @@ STATIC const char vmg_invalid_wiz[] = "Invalid wizard object"; STATIC const char vmg_wrongargnum[] = "Wrong number of arguments"; STATIC const char vmg_argstorefailed[] = "Error while storing arguments"; +/* --- Context-safe global data -------------------------------------------- */ + +#define MY_CXT_KEY __PACKAGE__ "::_guts" XS_VERSION + +typedef struct { + HV *b__op_stashes[OPc_MAX]; +} my_cxt_t; + +START_MY_CXT + /* --- Signatures ---------------------------------------------------------- */ #define SIG_WZO ((U16) (0x3891)) @@ -581,22 +591,26 @@ STATIC const vmg_wizard *vmg_wizard_dup(pTHX_ const vmg_wizard *w, CLONE_PARAMS #endif /* VMG_THREADSAFE */ -/* --- Context-safe global data -------------------------------------------- */ - -#define MY_CXT_KEY __PACKAGE__ "::_guts" XS_VERSION +/* --- Wizard SV objects --------------------------------------------------- */ -typedef struct { - HV *b__op_stashes[OPc_MAX]; -} my_cxt_t; +STATIC int vmg_wizard_sv_free(pTHX_ SV *sv, MAGIC *mg) { + if (PL_dirty) /* During global destruction, the context is already freed */ + return 0; -START_MY_CXT + vmg_wizard_free((vmg_wizard *) mg->mg_ptr); -/* --- Wizard SV objects --------------------------------------------------- */ + return 0; +} -STATIC int vmg_wizard_sv_free(pTHX_ SV *sv, MAGIC *mg); #if VMG_THREADSAFE -STATIC int vmg_wizard_sv_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *params); -#endif + +STATIC int vmg_wizard_sv_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *params) { + mg->mg_ptr = (char *) vmg_wizard_dup((const vmg_wizard *) mg->mg_ptr, params); + + return 0; +} + +#endif /* VMG_THREADSAFE */ STATIC MGVTBL vmg_wizard_sv_vtbl = { NULL, /* get */ @@ -680,25 +694,6 @@ STATIC const vmg_wizard *vmg_wizard_from_sv(const SV *wiz) { #endif -STATIC int vmg_wizard_sv_free(pTHX_ SV *sv, MAGIC *mg) { - if (PL_dirty) /* During global destruction, the context is already freed */ - return 0; - - vmg_wizard_free((vmg_wizard *) mg->mg_ptr); - - return 0; -} - -#if VMG_THREADSAFE - -STATIC int vmg_wizard_sv_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *params) { - mg->mg_ptr = (char *) vmg_wizard_dup((const vmg_wizard *) mg->mg_ptr, params); - - return 0; -} - -#endif /* VMG_THREADSAFE */ - /* --- User-level functions implementation --------------------------------- */ STATIC const MAGIC *vmg_find(const SV *sv, const SV *wiz) {