#endif /* VMG_MULTIPLICITY */
} MGWIZ;
+STATIC void vmg_op_info_init(pTHX_ unsigned int opinfo);
+
+STATIC MGWIZ *vmg_mgwiz_alloc(pTHX_ UV opinfo) {
+#define vmg_mgwiz_alloc(O) vmg_mgwiz_alloc(aTHX_ (O))
+ MGWIZ *w;
+ MGVTBL *t;
+
+ Newx(w, 1, MGWIZ);
+
+ w->uvar = 0;
+ w->opinfo = (U8) ((opinfo < 255) ? opinfo : 255);
+ if (w->opinfo)
+ vmg_op_info_init(aTHX_ w->opinfo);
+
+ Newx(t, 1, MGVTBL);
+ w->vtbl = t;
+
+ return w;
+}
+
STATIC void vmg_mgwiz_free(pTHX_ MGWIZ *w) {
#define vmg_mgwiz_free(W) vmg_mgwiz_free(aTHX_ (W))
if (!w)
PROTOTYPE: DISABLE
PREINIT:
I32 i = 0;
- UV opinfo;
MGWIZ *w;
MGVTBL *t;
- SV *cb;
+ SV *cb, *op_info, *copy_key;
CODE:
dMY_CXT;
#endif /* VMG_UVAR */
) { croak(vmg_wrongargnum); }
- Newx(t, 1, MGVTBL);
- Newx(w, 1, MGWIZ);
-
- cb = ST(i++);
- opinfo = SvOK(cb) ? SvUV(cb) : 0;
- w->opinfo = (U8) ((opinfo < 255) ? opinfo : 255);
- if (w->opinfo)
- vmg_op_info_init(w->opinfo);
+ op_info = ST(i++);
+ w = vmg_mgwiz_alloc(SvOK(op_info) ? SvUV(op_info) : 0);
+ t = w->vtbl;
VMG_SET_CB(ST(i++), data);
VMG_SET_CB(ST(i++), store);
VMG_SET_CB(ST(i++), exists);
VMG_SET_CB(ST(i++), delete);
- cb = ST(i++);
+
+ copy_key = ST(i++);
if (w->cb_fetch || w->cb_store || w->cb_exists || w->cb_delete)
- w->uvar = SvTRUE(cb) ? 2 : 1;
- else
- w->uvar = 0;
+ w->uvar = SvTRUE(copy_key) ? 2 : 1;
#endif /* VMG_UVAR */
#if VMG_MULTIPLICITY
w->owner = aTHX;
#endif /* VMG_MULTIPLICITY */
- w->vtbl = t;
#if VMG_THREADSAFE
ptable_store(MY_CXT.wizards, w, w);
#endif /* VMG_THREADSAFE */