Branch Coverage

src/b_buffer.c
Criterion Covered Total %
branch 41 90 45.5


line true false branch
15 0 91 if ((buf = malloc(sizeof(*buf))) == NULL) {
21 91 0 buf->size = factor? factor * B_BUFFER_BLOCK_SIZE: B_BUFFER_DEFAULT_FACTOR * B_BUFFER_BLOCK_SIZE;
24 0 91 if ((buf->data = malloc(buf->size)) == NULL) {
45 0 6628 if (buf == NULL) return 0;
58 0 50 if (buf == NULL) return;
63 50 0 if (fstat(fd, &st) == 0) {
64 18 32 if (S_ISFIFO(st.st_mode)) {
66 18 0 if (uname_ok != -1) {
71 18 0 if (release && major && minor) {
18 0 if (release && major && minor) {
18 0 if (release && major && minor) {
75 0 18 if (kernel_v >= 3 || (kernel_v == 2 && major_v == 6 && minor_v >= 31) ) {
0 0 if (kernel_v >= 3 || (kernel_v == 2 && major_v == 6 && minor_v >= 31) ) {
0 0 if (kernel_v >= 3 || (kernel_v == 2 && major_v == 6 && minor_v >= 31) ) {
0 0 if (kernel_v >= 3 || (kernel_v == 2 && major_v == 6 && minor_v >= 31) ) {
87 0 0 if (buf == NULL) return 0;
93 0 45323 if (buf == NULL) return 0;
99 0 137812 if (buf == NULL) return 0;
105 85625 6275 if (size % B_BUFFER_BLOCK_SIZE == 0) {
116 6275 0 if (buf == NULL || given == 0 || given % B_BUFFER_BLOCK_SIZE) {
6275 0 if (buf == NULL || given == 0 || given % B_BUFFER_BLOCK_SIZE) {
0 6275 if (buf == NULL || given == 0 || given % B_BUFFER_BLOCK_SIZE) {
132 0 85625 if (buf == NULL) {
137 0 85625 if (len == 0) return NULL;
139 0 85625 if (buf->fd == 0) {
148 1634 83991 if (b_buffer_full(buf)) {
149 0 1634 if (b_buffer_flush(buf) < 0) {
158 0 85625 if (padded_len > buf->unused) {
177 85625 0 if (given) {
184 0 0 if (given) {
195 41390 0 if (buf == NULL || buf->data == NULL) {
0 41390 if (buf == NULL || buf->data == NULL) {
200 0 41390 if (buf->fd == 0) {
205 0 41390 if (buf->size == 0) return 0;
206 6 41384 if (buf->unused == buf->size) return 0;
208 41384 41384 while ((off < buf->size) || (ret < 0 && errno == EINTR)) {
0 41384 while ((off < buf->size) || (ret < 0 && errno == EINTR)) {
0 0 while ((off < buf->size) || (ret < 0 && errno == EINTR)) {
209 0 41384 if ((ret = write(buf->fd, buf->data + off, buf->size - off)) < 0) {
210 0 0 if (errno != EINTR)
213 0 41384 else if (!ret) {
229 0 0 if (buf == NULL) return;
234 0 0 if (buf->data == NULL) return;
240 0 91 if (buf == NULL) return;
242 91 0 if (buf->data) {