xs/ToInstance.xs

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 48 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 71 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/Moose/Meta/Method/Accessor/Native/Hash/clear.pm ↑ Summary mop.c »
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 ▶ if (SvMAGICAL (target) && (mg = mg_find (target, PERL_MAGIC_backref))) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvMAGICAL (target) && (mg = mg_find (target, PERL_MAGIC_backref))) { 0 0 0
if (SvMAGICAL (target) && (mg = mg_find (target, PERL_MAGIC_backref))) { 0 0 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 ▶ if (!how_many) {
Branch: 1 branch
BranchTrueFalseTotal
if (!how_many) { 0 0 0
23 /* There was only 1 reference to this object. */
24 0 return;
25 }
26  
27 0 ▶ for (sva = PL_sv_arenaroot; sva; sva = (SV *)SvANY (sva)) {
Branch: 1 branch
BranchTrueFalseTotal
for (sva = PL_sv_arenaroot; sva; sva = (SV *)SvANY (sva)) { 0 0 0
28 0 register const SV *const svend = &sva[SvREFCNT (sva)];
29 register SV *sv;
30 0 ▶ for (sv = sva + 1; sv < svend; ++sv) {
Branch: 1 branch
BranchTrueFalseTotal
for (sv = sva + 1; sv < svend; ++sv) { 0 0 0
31 0 ▶ if (SvTYPE (sv) != SVTYPEMASK
Branch: 1 branch
BranchTrueFalseTotal
if (SvTYPE (sv) != SVTYPEMASK 0 0 0
32 0 ▶ && ((sv->sv_flags & SVf_ROK) == SVf_ROK)
Branch: 1 branch
BranchTrueFalseTotal
&& ((sv->sv_flags & SVf_ROK) == SVf_ROK) 0 0 0
33 0 ▶ && SvREFCNT (sv)
Branch: 1 branch
BranchTrueFalseTotal
&& SvREFCNT (sv) 0 0 0
34 0 ▶ && SvRV (sv) == target
Branch: 1 branch
BranchTrueFalseTotal
&& SvRV (sv) == target 0 0 0
35 0 ▶ && sv != rv) {
Branch: 1 branch
BranchTrueFalseTotal
&& sv != rv) { 0 0 0
36 0 ▶ if (on) {
Branch: 1 branch
BranchTrueFalseTotal
if (on) { 0 0 0
37 0 SvAMAGIC_on (sv);
38 }
39 else {
40 0 SvAMAGIC_off (sv);
41 }
42  
43 0 ▶ if (--how_many == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (--how_many == 0) { 0 0 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 ▶ if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) {
Branch: 12 branches
BranchTrueFalseTotal
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
if (Gv_AMG (SvSTASH (SvRV (rv))) && !SvAMAGIC (rv)) { 0 0 0
61 0 SvAMAGIC_on (rv);
62 0 S_reset_amagic (aTHX_ rv, TRUE);
63 }
« blib/lib/Moose/Meta/Method/Accessor/Native/Hash/clear.pm ↑ Summary mop.c »