Branch Coverage

Shared.xs
Criterion Covered Total %
branch 90 148 60.8


line true false branch
32 5 17 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
33 1 21 if (capacity < 1)
36 2 19 if (!h) croak("Data::CuckooFilter::Shared->new: %s", errbuf);
49 2 1 const char *nm = SvOK(name) ? SvPV_nolen(name) : NULL; /* undef -> default label */
50 1 2 if (capacity < 1)
53 0 2 if (!h) croak("Data::CuckooFilter::Shared->new_memfd: %s", errbuf);
66 1 1 if (!h) croak("Data::CuckooFilter::Shared->new_from_fd: %s", errbuf);
75 24 0 if (sv_isobject(self) && sv_derived_from(self, "Data::CuckooFilter::Shared")) {
24 0 if (sv_isobject(self) && sv_derived_from(self, "Data::CuckooFilter::Shared")) {
77 22 2 if (h) { sv_setiv(SvRV(self), 0); cf_destroy(h); } /* null first: activates EXTRACT's use-after-destroy croak + makes a double DESTROY a no-op */
85 21823 0 EXTRACT(self);
0 21823 EXTRACT(self);
0 21823 EXTRACT(self);
102 8 0 EXTRACT(self);
0 8 EXTRACT(self);
0 8 EXTRACT(self);
105 8 0 UV added = 0;
107 7 1 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
1 6 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
112 5 1 STRLEN cnt = (top >= 0) ? (STRLEN)(top + 1) : 0, i;
114 5 1 if (cnt) { /* resolve all bytes BEFORE locking */
115 0 5 Newx(ps, cnt, const char *); SAVEFREEPV(ps); /* freed on return OR unwind */
116 0 5 Newx(ls, cnt, STRLEN); SAVEFREEPV(ls);
117 5502 4 for (i = 0; i < cnt; i++) { /* a croak here holds NO lock; SAVEFREEPV cleans up */
119 5502 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
5502 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
124 5500 5 for (i = 0; i < cnt; i++) added += (UV)cf_add_locked(h, ps[i], ls[i]);
128 0 5 RETVAL = added;
137 26827 0 EXTRACT(self);
0 26827 EXTRACT(self);
1 26826 EXTRACT(self);
153 4006 0 EXTRACT(self);
0 4006 EXTRACT(self);
0 4006 EXTRACT(self);
169 1 0 EXTRACT(self);
0 1 EXTRACT(self);
0 1 EXTRACT(self);
180 13 0 EXTRACT(self);
0 13 EXTRACT(self);
0 13 EXTRACT(self);
186 0 13 RETVAL = n;
194 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
196 0 3 RETVAL = (UV)h->hdr->capacity;
204 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
206 0 3 RETVAL = (UV)h->hdr->num_buckets;
214 4 0 EXTRACT(self);
0 4 EXTRACT(self);
0 4 EXTRACT(self);
216 0 4 RETVAL = (UV)(h->hdr->num_buckets * (uint64_t)CF_SLOTS);
224 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
256 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
258 1 2 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
266 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
268 0 3 RETVAL = h->backing_fd;
276 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
278 0 2 if (cf_msync(h) != 0) croak("sync: %s", strerror(errno));
284 1 1 if (sv_isobject(self) && sv_derived_from(self, "Data::CuckooFilter::Shared")) {
1 0 if (sv_isobject(self) && sv_derived_from(self, "Data::CuckooFilter::Shared")) {
286 1 0 if (h && h->path) unlink(h->path);
1 0 if (h && h->path) unlink(h->path);
287 1 0 } else if (items >= 2 && SvOK(ST(1))) {
1 0 } else if (items >= 2 && SvOK(ST(1))) {