Branch Coverage

Shared.xs
Criterion Covered Total %
branch 105 244 43.0


line true false branch
30 0 10 if (!SvROK(self)) return;
32 0 10 if (!h) return;
40 6 0 EXTRACT_STK(self);
0 6 EXTRACT_STK(self);
0 6 EXTRACT_STK(self);
42 0 6 RETVAL = stk_size(h);
50 2 0 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
52 0 2 RETVAL = (UV)h->hdr->capacity;
60 3 0 EXTRACT_STK(self);
0 3 EXTRACT_STK(self);
0 3 EXTRACT_STK(self);
62 3 0 RETVAL = stk_size(h) == 0;
70 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
72 1 0 RETVAL = stk_size(h) >= (UV)h->hdr->capacity;
80 3 0 EXTRACT_STK(self);
0 3 EXTRACT_STK(self);
0 3 EXTRACT_STK(self);
88 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
90 1 0 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
98 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
100 0 1 RETVAL = h->backing_fd;
108 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
110 0 1 RETVAL = stk_create_eventfd(h);
119 0 0 EXTRACT_STK(self);
0 0 EXTRACT_STK(self);
0 0 EXTRACT_STK(self);
121 0 0 if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd);
0 0 if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd);
128 2 0 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
130 0 2 RETVAL = h->notify_fd;
138 2 0 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
140 2 0 RETVAL = stk_notify(h);
148 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
151 1 0 RETVAL = (v >= 0) ? newSViv((IV)v) : &PL_sv_undef;
159 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
168 1 0 if (sv_isobject(self_or_class)) {
170 0 1 if (!h) croak("destroyed object");
173 0 0 if (items < 2) croak("Usage: ...->unlink($path)");
176 0 1 if (!p) croak("cannot unlink anonymous or memfd object");
177 0 1 if (unlink(p) != 0) croak("unlink(%s): %s", p, strerror(errno));
183 2 0 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
212 3 2 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
214 0 5 if (!h) croak("Data::Stack::Shared::Int->new: %s", errbuf);
228 0 1 if (!h) croak("Data::Stack::Shared::Int->new_memfd: %s", errbuf);
241 0 1 if (!h) croak("Data::Stack::Shared::Int->new_from_fd: %s", errbuf);
251 35 0 EXTRACT_STK(self);
0 35 EXTRACT_STK(self);
0 35 EXTRACT_STK(self);
254 34 1 RETVAL = stk_try_push(h, &v, sizeof(v));
263 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
266 1 0 if (items > 2) timeout = SvNV(ST(2));
268 0 1 RETVAL = stk_push(h, &v, sizeof(v), timeout);
276 18 0 EXTRACT_STK(self);
0 18 EXTRACT_STK(self);
0 18 EXTRACT_STK(self);
279 16 2 RETVAL = stk_try_pop(h, &v) ? newSViv((IV)v) : &PL_sv_undef;
287 2 0 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
0 2 EXTRACT_STK(self);
290 2 0 if (items > 1) timeout = SvNV(ST(1));
292 1 1 RETVAL = stk_pop(h, &v, timeout) ? newSViv((IV)v) : &PL_sv_undef;
300 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
303 1 0 RETVAL = stk_peek(h, &v) ? newSViv((IV)v) : &PL_sv_undef;
322 0 3 if (max_len == 0) croak("max_len must be > 0");
323 0 3 if (max_len > (UV)(UINT32_MAX - sizeof(uint32_t)))
326 0 3 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
328 0 3 if (!h) croak("Data::Stack::Shared::Str->new: %s", errbuf);
342 0 0 if (max_len == 0) croak("max_len must be > 0");
343 0 0 if (max_len > (UV)(UINT32_MAX - sizeof(uint32_t)))
347 0 0 if (!h) croak("Data::Stack::Shared::Str->new_memfd: %s", errbuf);
360 0 0 if (!h) croak("Data::Stack::Shared::Str->new_from_fd: %s", errbuf);
370 6 0 EXTRACT_STK(self);
0 6 EXTRACT_STK(self);
0 6 EXTRACT_STK(self);
375 0 6 if (slen > max_len) slen = max_len;
381 6 0 if (slen < max_len) memset(buf + sizeof(uint32_t) + slen, 0, max_len - slen);
392 0 0 EXTRACT_STK(self);
0 0 EXTRACT_STK(self);
0 0 EXTRACT_STK(self);
395 0 0 if (items > 2) timeout = SvNV(ST(2));
399 0 0 if (slen > max_len) slen = max_len;
405 0 0 if (slen < max_len) memset(buf + sizeof(uint32_t) + slen, 0, max_len - slen);
415 5 0 EXTRACT_STK(self);
0 5 EXTRACT_STK(self);
0 5 EXTRACT_STK(self);
419 4 1 if (stk_try_pop(h, buf)) {
423 0 4 if (len > max_len) len = max_len;
436 0 0 EXTRACT_STK(self);
0 0 EXTRACT_STK(self);
0 0 EXTRACT_STK(self);
439 0 0 if (items > 1) timeout = SvNV(ST(1));
442 0 0 if (stk_pop(h, buf, timeout)) {
446 0 0 if (len > max_len) len = max_len;
459 1 0 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
0 1 EXTRACT_STK(self);
463 1 0 if (stk_peek(h, buf)) {
467 0 1 if (len > max_len) len = max_len;