xs/set_transient.xs

filter: Statementstmt 94.2% 33 / 35 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 95.3% 41 / 43 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/map_transient.xs ↑ Summary xs/vector_transient.xs »
1 # HAMT::Set::Transient: a set opened for a batch of updates.
2  
3 MODULE = HAMT PACKAGE = HAMT::Set::Transient
4  
5 void
6 add(self, ...)
7 SV *self
8 PREINIT:
9 hamt_txn *t;
10 I32 i;
11 CODE:
12 12165 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::add");
13 24165 ▶ for (i = 1; i < items; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i < items; i++) { 12165 12000 24165
14 12165 hamt_xs_put(aTHX_ &t->m, ST(i), NULL, "HAMT::Set::Transient::add");
15 /* Reading a member can run Perl, and Perl can close the transient. */
16 12001 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::add");
17 }
18 12000 XSRETURN(1);
19  
20 void
21 remove(self, ...)
22 SV *self
23 PREINIT:
24 hamt_txn *t;
25 I32 i;
26 CODE:
27 2440 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::remove");
28 4856 ▶ for (i = 1; i < items; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i < items; i++) { 2441 2415 4856
29 2441 hamt_xs_del(aTHX_ &t->m, ST(i), "HAMT::Set::Transient::remove");
30 2417 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::remove");
31 }
32 2415 XSRETURN(1);
33  
34 void
35 has(self, member)
36 SV *self
37 SV *member
38 PREINIT:
39 hamt_txn *t;
40 hamt_key k;
41 CODE:
42 7 hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::has");
43 6 hamt_key_from_sv(aTHX_ member, &k);
44 6 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::has");
45 6 ▶ ST(0) = boolSV(hamt_map_find(t->m.root, k.p, (size_t)k.len, k.utf8, k.hash) != NULL);
Branch: 1 branch
BranchTrueFalseTotal
ST(0) = boolSV(hamt_map_find(t->m.root, k.p, (size_t)k.len, k.utf8, k.hash) != NULL); 3 3 6
46 6 XSRETURN(1);
47  
48 void
49 count(self)
50 SV *self
51 PREINIT:
52 hamt_txn *t;
53 CODE:
54 5 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::count");
55 4 ST(0) = sv_2mortal(newSVuv((UV)t->m.count));
56 4 XSRETURN(1);
57  
58 void
59 persistent(self)
60 SV *self
61 PREINIT:
62 hamt_txn *t;
63 hamt_map *n;
64 hamt_node *root;
65 HV *origin;
66 SV *obj;
67 CODE:
68 9 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::persistent");
69 8 obj = hamt_handle_new(aTHX_ &hamt_set_vtbl, t->origin, t->m.root, t->m.count,
70 &n, "HAMT::Set::Transient::persistent");
71 7 root = t->m.root;
72 7 origin = t->origin;
73 7 t->open = 0;
74 7 t->m.root = NULL;
75 7 t->m.count = 0;
76 7 t->origin = NULL;
77 7 SvREFCNT_dec((SV *)origin);
78 7 ▶ if (root) hamt_node_release(HAMT_CX, root);
Branch: 1 branch
BranchTrueFalseTotal
if (root) hamt_node_release(HAMT_CX, root); 5 2 7
79 7 ST(0) = obj;
80 7 XSRETURN(1);
81  
82 void
83 _check(self)
84 SV *self
85 PREINIT:
86 hamt_txn *t;
87 CODE:
88 1 t = hamt_txn_handle(aTHX_ self, &hamt_set_txn_vtbl, "HAMT::Set::Transient::_check");
89 1 ST(0) = sv_2mortal(newSViv((IV)hamt_map_check(t->m.root, t->m.count)));
90 1 XSRETURN(1);
91  
92 void
93 CLONE_SKIP(...)
94 CODE:
95 0 ST(0) = &PL_sv_yes;
96 0 XSRETURN(1);
« xs/map_transient.xs ↑ Summary xs/vector_transient.xs »