Branch Coverage

Shared.xs
Criterion Covered Total %
branch 90 146 61.6


line true false branch
32 5 18 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
33 22 1 if (precision < HLL_MIN_PRECISION || precision > HLL_MAX_PRECISION)
1 21 if (precision < HLL_MIN_PRECISION || precision > HLL_MAX_PRECISION)
37 1 20 if (!h) croak("Data::HyperLogLog::Shared->new: %s", errbuf);
50 3 1 const char *nm = SvOK(name) ? SvPV_nolen(name) : NULL; /* undef -> default label */
51 3 1 if (precision < HLL_MIN_PRECISION || precision > HLL_MAX_PRECISION)
1 2 if (precision < HLL_MIN_PRECISION || precision > HLL_MAX_PRECISION)
55 0 2 if (!h) croak("Data::HyperLogLog::Shared->new_memfd: %s", errbuf);
68 0 1 if (!h) croak("Data::HyperLogLog::Shared->new_from_fd: %s", errbuf);
77 24 0 if (sv_isobject(self) && sv_derived_from(self, "Data::HyperLogLog::Shared")) {
24 0 if (sv_isobject(self) && sv_derived_from(self, "Data::HyperLogLog::Shared")) {
79 23 1 if (h) { sv_setiv(SvRV(self), 0); hll_destroy(h); } /* null first: activates EXTRACT's use-after-destroy croak + makes a double DESTROY a no-op */
87 420706 0 EXTRACT(self);
0 420706 EXTRACT(self);
0 420706 EXTRACT(self);
104 6 0 EXTRACT(self);
0 6 EXTRACT(self);
0 6 EXTRACT(self);
107 6 0 UV added = 0;
109 6 0 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
0 6 if (!SvROK(items) || SvTYPE(SvRV(items)) != SVt_PVAV)
114 5 1 STRLEN cnt = (top >= 0) ? (STRLEN)(top + 1) : 0, i;
116 5 1 if (cnt) { /* resolve all bytes BEFORE locking */
117 0 5 Newx(ps, cnt, const char *); SAVEFREEPV(ps); /* freed on return OR unwind */
118 0 5 Newx(ls, cnt, STRLEN); SAVEFREEPV(ls);
119 8002 4 for (i = 0; i < cnt; i++) { /* a croak here holds NO lock; SAVEFREEPV cleans up */
121 8002 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
8002 0 if (el && *el) ps[i] = SvPVbyte(*el, ls[i]);
126 8000 5 for (i = 0; i < cnt; i++) added += (UV)hll_add_locked(h, ps[i], ls[i]);
130 0 5 RETVAL = added;
138 19 0 EXTRACT(self);
0 19 EXTRACT(self);
1 18 EXTRACT(self);
144 1 17 RETVAL = (UV)(E + 0.5);
153 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
155 3 0 if (!sv_isobject(other) || !sv_derived_from(other, "Data::HyperLogLog::Shared"))
0 3 if (!sv_isobject(other) || !sv_derived_from(other, "Data::HyperLogLog::Shared"))
158 0 3 if (!o) croak("Attempted to use a destroyed Data::HyperLogLog::Shared object");
165 1 2 if (om != h->hdr->m)
185 1 0 EXTRACT(self);
0 1 EXTRACT(self);
0 1 EXTRACT(self);
196 4 0 EXTRACT(self);
0 4 EXTRACT(self);
0 4 EXTRACT(self);
198 0 4 RETVAL = h->hdr->precision;
206 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
208 0 2 RETVAL = h->hdr->m;
216 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
246 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
248 1 2 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
256 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
258 0 3 RETVAL = h->backing_fd;
266 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
268 0 2 if (hll_msync(h) != 0) croak("sync: %s", strerror(errno));
274 1 1 if (sv_isobject(self) && sv_derived_from(self, "Data::HyperLogLog::Shared")) {
1 0 if (sv_isobject(self) && sv_derived_from(self, "Data::HyperLogLog::Shared")) {
276 1 0 if (h && h->path) unlink(h->path);
1 0 if (h && h->path) unlink(h->path);
277 1 0 } else if (items >= 2 && SvOK(ST(1))) {
1 0 } else if (items >= 2 && SvOK(ST(1))) {