blob: 6123b7520158558bca9941fa21b6774f7aa72a8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#define MY_CXT_KEY "File::Glob::_guts" XS_VERSION
typedef struct {
HV * x_DG_ENTRIES;
Perl_ophook_t x_DG_OLD_OPHOOK;
} my_cxt_t;
START_MY_CXT
static void
glob_ophook(pTHX_ OP *o)
{
if (PL_dirty) return;
{
dMY_CXT;
if (!MY_CXT.x_DG_ENTRIES)
MY_CXT.x_DG_ENTRIES = get_hv("File::DosGlob::entries", 0);
if (MY_CXT.x_DG_ENTRIES)
(void)hv_delete(MY_CXT.x_DG_ENTRIES, (char *)&o, sizeof(OP *),G_DISCARD);
if (MY_CXT.x_DG_OLD_OPHOOK) MY_CXT.x_DG_OLD_OPHOOK(aTHX_ o);
}
}
MODULE = File::DosGlob PACKAGE = File::DosGlob
PROTOTYPES: DISABLE
BOOT:
{
MY_CXT_INIT;
{
dMY_CXT;
MY_CXT.x_DG_ENTRIES = NULL;
MY_CXT.x_DG_OLD_OPHOOK = PL_opfreehook;
PL_opfreehook = glob_ophook;
}
}
SV *
_callsite(...)
CODE:
PERL_UNUSED_VAR(items);
RETVAL = newSVpvn(
(char *)&cxstack[cxstack_ix].blk_sub.retop, sizeof(OP *)
);
OUTPUT:
RETVAL
|