#define VMG_OP_INFO_NAME 1
#define VMG_OP_INFO_OBJECT 2
-STATIC STRLEN *vmg_op_name_len = NULL;
+STATIC U32 vmg_op_name_refcnt = 0;
+STATIC STRLEN *vmg_op_name_len = NULL;
STATIC HV *vmg_b__op_stash = NULL;
for (t = 0; t < OP_max; ++t)
vmg_op_name_len[t] = strlen(PL_op_name[t]);
}
+ ++vmg_op_name_refcnt;
break;
case VMG_OP_INFO_OBJECT:
if (!vmg_b__op_stash) {
}
}
+STATIC void vmg_op_info_deinit(unsigned int opinfo) {
+ switch (opinfo) {
+ case VMG_OP_INFO_NAME:
+ if (vmg_op_name_refcnt > 0)
+ --vmg_op_name_refcnt;
+ if (!vmg_op_name_refcnt && vmg_op_name_len) {
+ Safefree(vmg_op_name_len);
+ vmg_op_name_len = NULL;
+ }
+ break;
+ case VMG_OP_INFO_OBJECT:
+ default:
+ break;
+ }
+}
+
STATIC SV *vmg_op_info(pTHX_ unsigned int opinfo) {
#define vmg_op_info(W) vmg_op_info(aTHX_ (W))
if (!PL_op)
if (w->cb_delete != NULL) { SvREFCNT_dec(SvRV(w->cb_delete)); }
#endif /* VMG_UVAR */
+ if (w->opinfo)
+ vmg_op_info_deinit(w->opinfo);
+
Safefree(w->vtbl);
Safefree(w);
RETVAL = newSVuv(vmg_dispell(SvRV(sv), sig));
OUTPUT:
RETVAL
-
-void
-_cleanup()
-PROTOTYPE:
-PPCODE:
- if (vmg_op_name_len) {
- Safefree(vmg_op_name_len);
- vmg_op_name_len = NULL;
- }
- XSRETURN(0);
our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
$EXPORT_TAGS{'all'} = [ @EXPORT_OK ];
-END { _cleanup() }
-
=head1 CAVEATS
If you store a magic object in the private data slot, the magic won't be accessible by L</getdata> since it's not copied by assignation.