Branch Coverage

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


line true false branch
15 0 92 if ((buf = malloc(sizeof(*buf))) == NULL) {
21 92 0 buf->size = factor? factor * B_BUFFER_BLOCK_SIZE: B_BUFFER_DEFAULT_FACTOR * B_BUFFER_BLOCK_SIZE;
24 0 92 if ((buf->data = malloc(buf->size)) == NULL) {
45 0 6629 if (buf == NULL) return 0;
58 0 51 if (buf == NULL) return;
63 51 0 if (fstat(fd, &st) == 0) {
64 18 33 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 138410 if (buf == NULL) return 0;
105 86024 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 86024 if (buf == NULL) {
137 0 86024 if (len == 0) return NULL;
139 0 86024 if (buf->fd == 0) {
148 1645 84379 if (b_buffer_full(buf)) {
149 0 1645 if (b_buffer_flush(buf) < 0) {
158 0 86024 if (padded_len > buf->unused) {
177 86024 0 if (given) {
184 0 0 if (given) {
195 41409 0 if (buf == NULL || buf->data == NULL) {
0 41409 if (buf == NULL || buf->data == NULL) {
200 0 41409 if (buf->fd == 0) {
205 0 41409 if (buf->size == 0) return 0;
206 6 41403 if (buf->unused == buf->size) return 0;
208 41403 41403 while ((off < buf->size) || (ret < 0 && errno == EINTR)) {
0 41403 while ((off < buf->size) || (ret < 0 && errno == EINTR)) {
0 0 while ((off < buf->size) || (ret < 0 && errno == EINTR)) {
209 0 41403 if ((ret = write(buf->fd, buf->data + off, buf->size - off)) < 0) {
210 0 0 if (errno != EINTR)
213 0 41403 else if (!ret) {
229 0 0 if (buf == NULL) return;
234 0 0 if (buf->data == NULL) return;
240 0 92 if (buf == NULL) return;
242 92 0 if (buf->data) {