Branch Coverage

secret_buffer_base.c
Criterion Covered Total %
branch 74 112 66.0


line true false branch
39 8 574 if (capacity) secret_buffer_alloc_at_least(buf, capacity);
40 572 10 if (ref_out) *ref_out= ref;
53 1223 10 if (buf->capacity != new_capacity) {
54 644 579 if (new_capacity) {
57 65 579 if (old && buf->capacity) {
65 0 if (old && buf->capacity) {
63 579 0 if (buf->data && buf->capacity) {
579 0 if (buf->data && buf->capacity) {
70 573 650 if (buf->len > buf->capacity)
74 51 1172 if (buf->stringify_sv) {
85 642 7 if (buf->capacity < min_capacity) {
96 575 1246 if (new_len > buf->capacity)
99 10 1811 if (new_len < buf->len)
103 199 1622 if (buf->stringify_sv)
115 0 481 if (!len_out)
119 481 0 if (thing && SvROK(thing) && !sv_isobject(thing))
181 300 if (thing && SvROK(thing) && !sv_isobject(thing))
1 180 if (thing && SvROK(thing) && !sv_isobject(thing))
122 481 0 if (!thing || !SvOK(thing)) {
1 480 if (!thing || !SvOK(thing)) {
126 161 319 else if ((src_buf= secret_buffer_from_magic(thing, 0))) {
128 161 0 return src_buf->data? src_buf->data : "";
130 19 300 else if ((span= secret_buffer_span_from_magic(thing, 0))) {
132 19 0 if (!buf_field || !*buf_field || !(src_buf= secret_buffer_from_magic(*buf_field, 0)))
19 0 if (!buf_field || !*buf_field || !(src_buf= secret_buffer_from_magic(*buf_field, 0)))
0 19 if (!buf_field || !*buf_field || !(src_buf= secret_buffer_from_magic(*buf_field, 0)))
134 19 0 if (span->lim > src_buf->len || span->pos > span->lim)
0 19 if (span->lim > src_buf->len || span->pos > span->lim)
137 19 0 return src_buf->data? (src_buf->data + span->pos) : "";
154 0 119 if (ofs > buf->len)
156 0 119 if (ofs + len > buf->len)
160 113 6 if (replacement_len > len) /* buffer is growing */
166 5 114 if (tail_len)
169 115 4 if (replacement_len)
171 3 116 if (replacement_len < len) /* buffer shrank, wipe remainder */
197 0 2 if (!n)
199 1 1 if (buf->capacity < buf->len + n)
224 2 2 while (n > 0) {
230 0 2 if (got <= 0) {
231 0 0 if (got < 0 && errno == EINTR)
0 0 if (got < 0 && errno == EINTR)
233 0 0 if ((flags & SECRET_BUFFER_NONBLOCK) && (got == 0 || errno == EWOULDBLOCK || errno == EAGAIN))
0 0 if ((flags & SECRET_BUFFER_NONBLOCK) && (got == 0 || errno == EWOULDBLOCK || errno == EAGAIN))
0 0 if ((flags & SECRET_BUFFER_NONBLOCK) && (got == 0 || errno == EWOULDBLOCK || errno == EAGAIN))
0 0 if ((flags & SECRET_BUFFER_NONBLOCK) && (got == 0 || errno == EWOULDBLOCK || errno == EAGAIN))
254 0 454 if (stream_fd < 0)
256 0 454 if (PerlIO_get_cnt(stream))
259 35 419 if (buf->capacity < buf->len + count)
282 440 14 if (ret > 0)
301 0 4 if (stream_fd < 0)
331 445 36 if (stream_fd < 0 || n_buffered > 0) {
3 442 if (stream_fd < 0 || n_buffered > 0) {
332 0 39 if (n_buffered <= 0) {
333 0 0 if (PerlIO_fill(stream) < 0)
336 0 0 if (n_buffered <= 0)
341 0 39 if (count > n_buffered)