line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
2
|
|
|
|
|
|
|
#include "perl.h" |
3
|
|
|
|
|
|
|
#include "XSUB.h" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
static void |
6
|
0
|
|
|
|
|
|
S_reset_amagic (pTHX_ SV *rv, const bool on) |
7
|
|
|
|
|
|
|
{ |
8
|
|
|
|
|
|
|
/* It is assumed that you've already turned magic on/off on rv */ |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SV *sva; |
11
|
0
|
|
|
|
|
|
SV *const target = SvRV (rv); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
/* Less 1 for the reference we've already dealt with. */ |
14
|
0
|
|
|
|
|
|
U32 how_many = SvREFCNT (target) - 1; |
15
|
|
|
|
|
|
|
MAGIC *mg; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
if (SvMAGICAL (target) && (mg = mg_find (target, PERL_MAGIC_backref))) { |
|
|
0
|
|
|
|
|
|
18
|
|
|
|
|
|
|
/* Back references also need to be found, but aren't part of the target's reference count. */ |
19
|
0
|
|
|
|
|
|
how_many += 1 + av_len ((AV *)mg->mg_obj); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if (!how_many) { |
23
|
|
|
|
|
|
|
/* There was only 1 reference to this object. */ |
24
|
0
|
|
|
|
|
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
for (sva = PL_sv_arenaroot; sva; sva = (SV *)SvANY (sva)) { |
28
|
0
|
|
|
|
|
|
register const SV *const svend = &sva[SvREFCNT (sva)]; |
29
|
|
|
|
|
|
|
register SV *sv; |
30
|
0
|
0
|
|
|
|
|
for (sv = sva + 1; sv < svend; ++sv) { |
31
|
0
|
0
|
|
|
|
|
if (SvTYPE (sv) != SVTYPEMASK |
32
|
0
|
0
|
|
|
|
|
&& ((sv->sv_flags & SVf_ROK) == SVf_ROK) |
33
|
0
|
0
|
|
|
|
|
&& SvREFCNT (sv) |
34
|
0
|
0
|
|
|
|
|
&& SvRV (sv) == target |
35
|
0
|
0
|
|
|
|
|
&& sv != rv) { |
36
|
0
|
0
|
|
|
|
|
if (on) { |
37
|
0
|
|
|
|
|
|
SvAMAGIC_on (sv); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
|
SvAMAGIC_off (sv); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
if (--how_many == 0) { |
44
|
|
|
|
|
|
|
/* We have found them all. */ |
45
|
0
|
|
|
|
|
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
MODULE = Moose::Meta::Role::Application::ToInstance PACKAGE = Moose::Meta::Role::Application::ToInstance |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
void |
57
|
|
|
|
|
|
|
_reset_amagic (rv) |
58
|
|
|
|
|
|
|
SV *rv |
59
|
|
|
|
|
|
|
CODE: |
60
|
0
|
0
|
|
|
|
|
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
SvAMAGIC_on (rv); |
62
|
0
|
|
|
|
|
|
S_reset_amagic (aTHX_ rv, TRUE); |
63
|
|
|
|
|
|
|
} |