Branch Coverage

src/ldns/radix.c
Criterion Covered Total %
branch 0 374 0.0


line true false branch
93 0 0 if (!node) {
120 0 0 if (!tree) {
137 0 0 if (tree) {
152 0 0 if (tree) {
153 0 0 if (tree->root) {
175 0 0 if (!tree || !key || !data) {
0 0 if (!tree || !key || !data) {
0 0 if (!tree || !key || !data) {
179 0 0 if (!add) {
183 0 0 if (!ldns_radix_find_prefix(tree, key, len, &prefix, &pos)) {
186 0 0 if (len == 0) {
198 0 0 if (!prefix) {
203 0 0 if (!ldns_radix_array_space(prefix, key[0])) {
213 0 0 if (len > 1) {
215 0 0 if (!ldns_radix_prefix_remainder(1, key,
226 0 0 } else if (pos == len) {
228 0 0 if (prefix->data) {
240 0 0 if (byte < prefix->offset ||
0 0 if (byte < prefix->offset ||
249 0 0 if (!ldns_radix_array_space(prefix, byte)) {
256 0 0 if (pos+1 < len) {
258 0 0 if (!ldns_radix_str_create(
269 0 0 } else if (prefix->array[byte-prefix->offset].edge == NULL) {
279 0 0 if (pos+1 < len) {
281 0 0 if (!ldns_radix_str_create(
297 0 0 if (!ldns_radix_array_split(&prefix->array[byte-(prefix->offset)],
318 0 0 if (del) {
340 0 0 if (!tree || !key) {
0 0 if (!tree || !key) {
344 0 0 while (node) {
345 0 0 if (pos == len) {
346 0 0 return node->data?node:NULL;
349 0 0 if (byte < node->offset) {
353 0 0 if (byte >= node->len) {
357 0 0 if (node->array[byte].len > 0) {
359 0 0 if (pos + node->array[byte].len > len) {
362 0 0 if (memcmp(&key[pos], node->array[byte].str,
388 0 0 if (!tree || !tree->root || !key) {
0 0 if (!tree || !tree->root || !key) {
0 0 if (!tree || !tree->root || !key) {
394 0 0 while (pos < len) {
396 0 0 if (byte < node->offset) {
405 0 0 if (byte >= node->len) {
411 0 0 if (*result == NULL) {
417 0 0 if (!node->array[byte].edge) {
423 0 0 if (*result == NULL) {
428 0 0 if (node->array[byte].len != 0) {
430 0 0 if (pos + node->array[byte].len > len) {
432 0 0 if (memcmp(&key[pos], node->array[byte].str,
440 0 0 if (*result == NULL) {
448 0 0 if (memcmp_res < 0) {
452 0 0 } else if (memcmp_res > 0) {
454 0 0 if (*result == NULL) {
464 0 0 if (node->data) {
483 0 0 if (!tree || !tree->root) {
0 0 if (!tree || !tree->root) {
487 0 0 if (first->data) {
501 0 0 if (!tree || !tree->root) {
0 0 if (!tree || !tree->root) {
515 0 0 if (!node) {
518 0 0 if (node->len) {
521 0 0 if (next) {
526 0 0 while (node->parent) {
530 0 0 for (; index < node->len; index++) {
531 0 0 if (node->array[index].edge) {
534 0 0 if (node->array[index].edge->data) {
539 0 0 if (next) {
556 0 0 if (!node) {
561 0 0 while (node->parent) {
567 0 0 if (prev) {
570 0 0 if (node->data) {
587 0 0 if (!node) {
590 0 0 for (j = 0; j < d; j++) {
593 0 0 if (str) {
596 0 0 for (l=0; l < len; l++) {
604 0 0 if (node->data) {
609 0 0 for (j = 0; j < node->len; j++) {
610 0 0 if (node->array[j].edge) {
626 0 0 if (!fd || !tree) {
0 0 if (!fd || !tree) {
629 0 0 if (!tree->root) {
647 0 0 if (!tree2 || !tree2->root) {
0 0 if (!tree2 || !tree2->root) {
653 0 0 while (cur_node) {
656 0 0 if (cur_node->data) {
660 0 0 if (status != LDNS_STATUS_OK &&
0 0 if (status != LDNS_STATUS_OK &&
666 0 0 if (status == LDNS_STATUS_OK) {
687 0 0 if (!tree1 || !tree1->root || num == 0) {
0 0 if (!tree1 || !tree1->root || num == 0) {
0 0 if (!tree1 || !tree1->root || num == 0) {
690 0 0 if (!tree2) {
693 0 0 if (!*tree2) {
695 0 0 if (!*tree2) {
700 0 0 while (count < num && cur_node) {
0 0 while (count < num && cur_node) {
701 0 0 if (cur_node->data) {
708 0 0 if (!cur_data) {
713 0 0 if (status != LDNS_STATUS_OK &&
0 0 if (status != LDNS_STATUS_OK &&
744 0 0 if (!node) {
747 0 0 for (i=0; i < node->len; i++) {
782 0 0 if (!n) {
787 0 0 while (n) {
788 0 0 if (pos == len) {
793 0 0 if (byte < n->offset) {
798 0 0 if (byte >= n->len) {
804 0 0 if (n->array[byte].len != 0) {
806 0 0 if (pos + n->array[byte].len > len) {
809 0 0 if (memcmp(&key[pos], n->array[byte].str,
817 0 0 if (!n) {
840 0 0 if (!node->array) {
844 0 0 if (!node->array) {
857 0 0 if (node->len == 0) {
861 0 0 } else if (byte < node->offset) {
866 0 0 if (node->len + need > node->capacity) {
868 0 0 if (!ldns_radix_array_grow(node,
877 0 0 for (index = 0; index < node->len; index++) {
878 0 0 if (node->array[index+need].edge) {
887 0 0 } else if (byte - node->offset >= node->len) {
891 0 0 if (node->len + need > node->capacity) {
893 0 0 if (!ldns_radix_array_grow(node,
920 0 0 if (need > size) {
923 0 0 if (size > 256) {
927 0 0 if (!a) {
954 0 0 if (!array->str) {
980 0 0 if (!*split_str) {
1005 0 0 if (ldns_radix_str_is_prefix(str_to_add, strlen_to_add,
1020 0 0 if (array->len - strlen_to_add > 1) {
1021 0 0 if (!ldns_radix_prefix_remainder(strlen_to_add+1,
1028 0 0 if (strlen_to_add != 0) {
1030 0 0 if (!dup_str) {
1037 0 0 if (!ldns_radix_array_space(add,
1058 0 0 } else if (ldns_radix_str_is_prefix(array->str, array->len,
1073 0 0 if (strlen_to_add - array->len > 1) {
1074 0 0 if (!ldns_radix_prefix_remainder(array->len+1,
1081 0 0 if (!ldns_radix_array_space(array->edge,
1117 0 0 if (!common) {
1120 0 0 if (array->len - common_len > 1) {
1121 0 0 if (!ldns_radix_prefix_remainder(common_len+1,
1126 0 0 if (strlen_to_add - common_len > 1) {
1127 0 0 if (!ldns_radix_prefix_remainder(common_len+1,
1133 0 0 if (common_len > 0) {
1135 0 0 if (!common_str) {
1192 0 0 if (len1 == 0) {
1195 0 0 if (len1 > len2) {
1216 0 0 for (i=0; i
1217 0 0 if (str1[i] != str2[i]) {
1237 0 0 for (i = 0; i < node->len; i++) {
1238 0 0 if (node->array[i].edge) {
1240 0 0 if (node->array[i].edge->data) {
1245 0 0 if (next) {
1265 0 0 while (i > 0) {
1267 0 0 if (node->array[i].edge) {
1270 0 0 if (prev) {
1289 0 0 if (last) {
1291 0 0 } else if (node->data) {
1309 0 0 for (i=(int)(node->len)-1; i >= 0; i--) {
1310 0 0 if (node->array[i].edge) {
1312 0 0 if (node->array[i].edge->len > 0) {
1316 0 0 if (last) {
1321 0 0 if (node->array[i].edge->data) {
1339 0 0 while (node) {
1340 0 0 if (node->data) {
1343 0 0 } else if (node->len == 1 && node->parent) {
0 0 } else if (node->len == 1 && node->parent) {
1347 0 0 } else if (node->len == 0) {
1350 0 0 if (!parent) {
1391 0 0 if (!join_str) {
1436 0 0 if (parent->len == 1) {
1438 0 0 } else if (parent_index == 0) {
1458 0 0 if (!node) {
1461 0 0 for (i=0; i < node->len; i++) {
1499 0 0 while (n < node->len && node->array[n].edge == NULL) {
0 0 while (n < node->len && node->array[n].edge == NULL) {
1502 0 0 if (n == 0) {
1505 0 0 if (n == node->len) {
1515 0 0 for (i=0; i < node->len; i++) {
1516 0 0 if (node->array[i].edge) {
1535 0 0 while (n < node->len && node->array[node->len-1-n].edge == NULL) {
0 0 while (n < node->len && node->array[node->len-1-n].edge == NULL) {
1538 0 0 if (n == 0) {
1541 0 0 if (n == node->len) {
1560 0 0 if (node->len <= node->capacity/2 && node->len != node->capacity) {
0 0 if (node->len <= node->capacity/2 && node->len != node->capacity) {
1563 0 0 if (!a) {
1584 0 0 if (node->data) {