Branch Coverage

Shared.xs
Criterion Covered Total %
branch 109 176 61.9


line true false branch
33 5 25 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
34 1 29 if (capacity < 1)
36 28 1 if (!(fp_rate > 0.0 && fp_rate < 1.0))
2 26 if (!(fp_rate > 0.0 && fp_rate < 1.0))
39 2 24 if (!h) croak("Data::BloomFilter::Shared->new: %s", errbuf);
53 4 1 const char *nm = SvOK(name) ? SvPV_nolen(name) : NULL; /* undef -> default label */
54 1 4 if (capacity < 1)
56 3 1 if (!(fp_rate > 0.0 && fp_rate < 1.0))
1 2 if (!(fp_rate > 0.0 && fp_rate < 1.0))
59 0 2 if (!h) croak("Data::BloomFilter::Shared->new_memfd: %s", errbuf);
72 1 1 if (!h) croak("Data::BloomFilter::Shared->new_from_fd: %s", errbuf);
81 29 0 if (sv_isobject(self) && sv_derived_from(self, "Data::BloomFilter::Shared")) {
29 0 if (sv_isobject(self) && sv_derived_from(self, "Data::BloomFilter::Shared")) {
83 27 2 if (h) { sv_setiv(SvRV(self), 0); bf_destroy(h); } /* null first: activates EXTRACT's use-after-destroy croak + makes a double DESTROY a no-op */
91 26007 0 EXTRACT(self);
0 26007 EXTRACT(self);
0 26007 EXTRACT(self);
108 11 0 EXTRACT(self);
0 11 EXTRACT(self);
0 11 EXTRACT(self);
111 11 0 UV added = 0;
113 10 1 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
1 9 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
118 8 1 STRLEN cnt = (top >= 0) ? (STRLEN)(top + 1) : 0, i;
120 8 1 if (cnt) { /* resolve all bytes BEFORE locking */
121 0 8 Newx(ps, cnt, const char *); SAVEFREEPV(ps); /* freed on return OR unwind */
122 0 8 Newx(ls, cnt, STRLEN); SAVEFREEPV(ls);
123 6802 7 for (i = 0; i < cnt; i++) { /* a croak here holds NO lock; SAVEFREEPV cleans up */
125 6802 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
6802 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
130 6800 8 for (i = 0; i < cnt; i++) added += (UV)bf_add_locked(h, ps[i], ls[i]);
134 0 8 RETVAL = added;
143 24811 0 EXTRACT(self);
0 24811 EXTRACT(self);
1 24810 EXTRACT(self);
159 4 0 EXTRACT(self);
0 4 EXTRACT(self);
0 4 EXTRACT(self);
161 4 0 if (!sv_isobject(other) || !sv_derived_from(other, "Data::BloomFilter::Shared"))
0 4 if (!sv_isobject(other) || !sv_derived_from(other, "Data::BloomFilter::Shared"))
164 0 4 if (!o) croak("Attempted to use a destroyed Data::BloomFilter::Shared object");
170 4 0 if (om != h->hdr->m_bits || ok != h->hdr->k)
1 3 if (om != h->hdr->m_bits || ok != h->hdr->k)
181 0 3 Newx(tmp, (size_t)words, uint64_t);
196 1 0 EXTRACT(self);
0 1 EXTRACT(self);
0 1 EXTRACT(self);
207 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
209 0 3 RETVAL = (UV)h->hdr->capacity;
217 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
219 0 3 RETVAL = (UV)h->hdr->m_bits;
227 5 0 EXTRACT(self);
0 5 EXTRACT(self);
0 5 EXTRACT(self);
229 0 5 RETVAL = h->hdr->k;
237 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
239 0 3 RETVAL = h->hdr->fp_rate;
247 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
253 0 2 RETVAL = n;
261 6 0 EXTRACT(self);
0 6 EXTRACT(self);
0 6 EXTRACT(self);
298 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
300 1 2 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
308 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
310 0 3 RETVAL = h->backing_fd;
318 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
320 0 2 if (bf_msync(h) != 0) croak("sync: %s", strerror(errno));
326 1 1 if (sv_isobject(self) && sv_derived_from(self, "Data::BloomFilter::Shared")) {
1 0 if (sv_isobject(self) && sv_derived_from(self, "Data::BloomFilter::Shared")) {
328 1 0 if (h && h->path) unlink(h->path);
1 0 if (h && h->path) unlink(h->path);
329 1 0 } else if (items >= 2 && SvOK(ST(1))) {
1 0 } else if (items >= 2 && SvOK(ST(1))) {