Branch Coverage

Shared.xs
Criterion Covered Total %
branch 98 160 61.2


line true false branch
33 5 26 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
35 7 24 if (!h) croak("Data::CountMinSketch::Shared->new: %s", errbuf);
49 3 1 const char *nm = SvOK(name) ? SvPV_nolen(name) : NULL; /* undef -> default label */
51 2 2 if (!h) croak("Data::CountMinSketch::Shared->new_memfd: %s", errbuf);
64 1 1 if (!h) croak("Data::CountMinSketch::Shared->new_from_fd: %s", errbuf);
73 29 0 if (sv_isobject(self) && sv_derived_from(self, "Data::CountMinSketch::Shared")) {
29 0 if (sv_isobject(self) && sv_derived_from(self, "Data::CountMinSketch::Shared")) {
75 27 2 if (h) { sv_setiv(SvRV(self), 0); cms_destroy(h); } /* null first: activates EXTRACT's use-after-destroy croak + makes a double DESTROY a no-op */
84 7127 0 EXTRACT(self);
0 7127 EXTRACT(self);
0 7127 EXTRACT(self);
95 7106 20 RETVAL = total;
104 7 0 EXTRACT(self);
0 7 EXTRACT(self);
0 7 EXTRACT(self);
108 6 1 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
1 5 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
113 4 1 STRLEN cnt = (top >= 0) ? (STRLEN)(top + 1) : 0, i;
115 4 1 if (cnt) { /* resolve all bytes BEFORE locking */
116 0 4 Newx(ps, cnt, const char *); SAVEFREEPV(ps); /* freed on return OR unwind */
117 0 4 Newx(ls, cnt, STRLEN); SAVEFREEPV(ls);
118 2502 3 for (i = 0; i < cnt; i++) { /* a croak here holds NO lock; SAVEFREEPV cleans up */
120 2502 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
2502 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
125 2500 4 for (i = 0; i < cnt; i++) cms_add_locked(h, ps[i], ls[i], 1);
128 0 4 RETVAL = (UV)cnt; /* every element is added (CMS add never fails) */
138 10019 0 EXTRACT(self);
0 10019 EXTRACT(self);
1 10018 EXTRACT(self);
147 9991 27 RETVAL = est;
156 4 0 EXTRACT(self);
0 4 EXTRACT(self);
0 4 EXTRACT(self);
158 4 0 if (!sv_isobject(other) || !sv_derived_from(other, "Data::CountMinSketch::Shared"))
0 4 if (!sv_isobject(other) || !sv_derived_from(other, "Data::CountMinSketch::Shared"))
161 0 4 if (!o) croak("Attempted to use a destroyed Data::CountMinSketch::Shared object");
167 3 1 if (ow != h->hdr->w || od != h->hdr->d)
0 3 if (ow != h->hdr->w || od != h->hdr->d)
179 0 3 Newx(tmp, (size_t)cells, uint64_t);
188 0 3 if (h->hdr->total > UINT64_MAX - other_total) h->hdr->total = UINT64_MAX;
197 1 0 EXTRACT(self);
0 1 EXTRACT(self);
0 1 EXTRACT(self);
208 14 0 EXTRACT(self);
0 14 EXTRACT(self);
0 14 EXTRACT(self);
214 0 14 RETVAL = t;
222 7 0 EXTRACT(self);
0 7 EXTRACT(self);
0 7 EXTRACT(self);
224 0 7 RETVAL = (UV)h->hdr->w;
232 6 0 EXTRACT(self);
0 6 EXTRACT(self);
0 6 EXTRACT(self);
234 0 6 RETVAL = (UV)h->hdr->d;
242 1 0 EXTRACT(self);
0 1 EXTRACT(self);
0 1 EXTRACT(self);
244 0 1 RETVAL = (UV)((uint64_t)h->hdr->d * h->hdr->w);
252 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
285 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
287 1 2 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
295 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
297 0 3 RETVAL = h->backing_fd;
305 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
307 0 2 if (cms_msync(h) != 0) croak("sync: %s", strerror(errno));
313 1 1 if (sv_isobject(self) && sv_derived_from(self, "Data::CountMinSketch::Shared")) {
1 0 if (sv_isobject(self) && sv_derived_from(self, "Data::CountMinSketch::Shared")) {
315 1 0 if (h && h->path) unlink(h->path);
1 0 if (h && h->path) unlink(h->path);
316 1 0 } else if (items >= 2 && SvOK(ST(1))) {
1 0 } else if (items >= 2 && SvOK(ST(1))) {