Branch Coverage

functions.c
Criterion Covered Total %
branch 629 670 93.8


line true false branch
57 87 2727 if (!ref) {
60 2727 0 return SvPV(*ref, PL_na);
78 20 1896 if (!ref) {
81 1887 9 return SvIV(*ref);
99 2 926 if (!ref) {
102 0 926 return SvUV(*ref);
138 1 2 if (len > 511) {
184 208 52 for (i = 0; i < 4; i++) {
221 12164 15442 : ((c >= 'a') && (c <= 'f')) ? 10 + (c - 'a')
15439 0 : ((c >= 'a') && (c <= 'f')) ? 10 + (c - 'a')
222 15439 3 : -1;
234 53 5508 if (!n) {
239 104338 5508 for (c = 0; n; c++) {
261 2115970 66129 for (i = 0; i < len; i++) {
287 81 7 for (i = 0; i < len; i++) {
323 3 16005 if (len == 0) {
327 2047795 16005 for (i = 0; i < len; i++) {
328 380263 1667532 buf[len - 1 - i] = (n128_tstbit(num, i) ? '1' : '0');
350 1 12 if (!version) {
357 155 10 for (i = 0; i < len; i++) {
358 2 153 if (!isdigit(ip_int_str[i])) {
359 1 1 memset(buf, '0', (version == 4) ? 32 : 128);
360 1 1 buf[(version == 4) ? 32 : 128] = '\0';
367 1 9 if (!res) {
390 7 3 if (len <= 32) {
420 2 947 if (!len) {
427 10530 590 for (i = 0; i < len; i++) {
428 2017 8513 if (!isdigit(str[i]) && str[i] != '.') {
357 1660 if (!isdigit(str[i]) && str[i] != '.') {
436 1 589 if (str[0] == '.') {
441 1 588 if (str[len - 1] == '.') {
448 10153 587 for (i = 0; i < len; i++) {
449 1656 8497 if (str[i] == '.') {
450 1 1655 if (quads == 3) {
461 9554 586 for (i = 0; i < (len - 1); i++) {
462 1650 7904 if ((str[i] == '.') && (str[i + 1] == '.')) {
1 1649 if ((str[i] == '.') && (str[i + 1] == '.')) {
470 2235 577 for (cq_index = 0; cq_index <= quads; cq_index++) {
471 1649 586 i = (cq_index > 0) ? (quadspots[cq_index - 1]) : 0;
476 2232 3 if (STRTOL_FAILED(current_quad, str + i, endptr)
0 2232 if (STRTOL_FAILED(current_quad, str + i, endptr)
0 3 if (STRTOL_FAILED(current_quad, str + i, endptr)
295 1937 if (STRTOL_FAILED(current_quad, str + i, endptr)
295 0 if (STRTOL_FAILED(current_quad, str + i, endptr)
477 2232 0 || (!(current_quad >= 0 && current_quad < 256))) {
6 2226 || (!(current_quad >= 0 && current_quad < 256))) {
509 368 79 max_colons = (double_colon == NULL) ? 7 : 8;
514 16654 445 for (i = 0; i < len; i++) {
515 2646 14008 if (str[i] == ':') {
516 2 2644 if (octs == max_colons) {
523 12 433 if (!octs) {
527 3060 430 for (oct_index = 0; oct_index <= octs; oct_index++) {
528 2627 433 i = (oct_index > 0) ? (octspots[oct_index - 1]) : 0;
532 119 2941 if (str[i] == ':') {
535 68 2873 if (strlen(str + i) == 0) {
542 363 2510 if ((oct_index == octs) && NI_ip_is_ipv4(cc)) {
16 347 if ((oct_index == octs) && NI_ip_is_ipv4(cc)) {
549 347 2510 if (next_oct == NULL) {
556 11338 2855 while (cc != next_oct) {
557 2 11336 if (!isxdigit(*cc)) {
564 2855 2 if (is_hd && (count <= 4)) {
2854 1 if (is_hd && (count <= 4)) {
574 40 390 if ((str[0] == ':') && (str[1] != ':')) {
1 39 if ((str[0] == ':') && (str[1] != ':')) {
580 68 361 if ((str[len - 1] == ':') && (str[len - 2] != ':')) {
1 67 if ((str[len - 1] == ':') && (str[len - 2] != ':')) {
588 77 351 if ((double_colon != NULL) && (strstr(double_colon + 1, "::"))) {
1 76 if ((double_colon != NULL) && (strstr(double_colon + 1, "::"))) {
596 77 350 if ((octs != 7) && (double_colon == NULL)) {
1 76 if ((octs != 7) && (double_colon == NULL)) {
614 560 423 if ((!strchr(str, ':')) && NI_ip_is_ipv4(str)) {
549 11 if ((!strchr(str, ':')) && NI_ip_is_ipv4(str)) {
616 421 13 } else if (NI_ip_is_ipv6(str)) {
641 1 143 if (!version) {
648 1 142 if (len < 0) {
650 2 140 } else if (len > size) {
673 17 30 len = (len == 0) ? 128 : (128 - len);
675 4482 47 for (i = 0; i < len; i++) {
692 53 8 mask = (len == 0) ? 0xFFFFFFFF : ((1 << (32 - len)) - 1);
711 1 27 if (!version) {
718 26 1 if ((len < 0) || (len > size)) {
2 24 if ((len < 0) || (len > size)) {
754 949 5 : (!strcmp(op_str, "lt")) ? LT
755 939 10 : (!strcmp(op_str, "le")) ? LE
756 9 930 : (!strcmp(op_str, "ge")) ? GE
757 7 2 : 0;
759 2 952 if (!op) {
764 947 5 if ((op == GT) || (op == GE)) {
7 940 if ((op == GT) || (op == GE)) {
772 2 950 if (strlen(b) != (strlen(e))) {
780 18 2 (!res && ((op == GE) || (op == LE)))
5 13 (!res && ((op == GE) || (op == LE)))
782 20 930 : (res > 0);
921 14 : (res > 0);
801 5 10 if (!n128_cmp(begin_1, begin_2)) {
802 2 3 if (!n128_cmp(end_1, end_2)) {
808 2 1 : IP_B_IN_A_OVERLAP;
812 2 8 if (!n128_cmp(end_1, end_2)) {
815 1 1 : IP_A_IN_B_OVERLAP;
820 5 3 if (res < 0) {
822 2 3 if (res < 0) {
828 2 1 : IP_B_IN_A_OVERLAP;
833 1 2 if (res < 0) {
840 1 1 : IP_A_IN_B_OVERLAP;
858 4 9 if (begin_1 == begin_2) {
859 2 2 if (end_1 == end_2) {
866 1 1 : IP_B_IN_A_OVERLAP;
870 2 7 if (end_1 == end_2) {
874 1 1 : IP_A_IN_B_OVERLAP;
878 4 3 if (begin_1 < begin_2) {
879 2 2 if (end_1 < begin_2) {
886 1 1 : IP_B_IN_A_OVERLAP;
890 1 2 if (end_2 < begin_1) {
898 1 1 : IP_A_IN_B_OVERLAP;
939 22 1 if (!( (b1_len == (int) strlen(end_1))
1 20 if (!( (b1_len == (int) strlen(end_1))
940 21 1 && (b2_len == (int) strlen(end_2))
947 1 19 if (!res) {
953 1 18 if (!res) {
960 8 10 if (b1_len <= 32) {
995 49 1 if ((len < 0) || (len > 128)) {
1 48 if ((len < 0) || (len > 128)) {
1001 4609 48 for (i = 0; i < (128 - len); i++) {
1006 1 47 if (n128_cmp_ui(&mask, 0)) {
1026 63 1 if ((len < 0) || (len > 32)) {
1 62 if ((len < 0) || (len > 32)) {
1031 53 9 mask = (len == 0) ? 0xFFFFFFFF : ((1 << (32 - len)) - 1);
1033 1 61 if ((ip & mask) != 0) {
1055 1 159 if (len < 0) {
1062 1 158 if (len > iplen) {
1070 6062 156 while (*c != '\0') {
1071 2 6060 if (*c != '0') {
1078 1 155 if (iplen != NI_iplengths(version)) {
1100 110732 10 for (i = 0; i < bits; i++) {
1101 5551 105181 if ((begin & 1) == (end & 1)) {
1129 1316777 32 for (i = 0; i < bits; i++) {
1130 15963 1300814 if (n128_tstbit(num1, i) == n128_tstbit(num2, i)) {
1160 1 14 if (bin1_len != bin2_len) {
1167 243 2 for (i = (bin1_len - 1); i >= 0; i--) {
1168 12 231 if (bitstr_1[i] == bitstr_2[i]) {
1256 4 16033 if (size > iplen) {
1262 24 16009 if (version == 4) {
1268 64036 16009 for (i = 0; i < 4; i++) {
1275 64011 16009 for (i = (4 - longs), j = 0; i < 4; i++, j++) {
1277 3 16002 (i == (4 - longs) && excess)
1279 16005 48006 : 32;
1310 3 14 if (len1 != len2) {
1314 2 12 if (len1 > (maxlen - 1)) {
1359 5561 77 while (begin <= end) {
1365 107730 5561 for (i = 0; i < (int) zeroes; i++) {
1376 2549 5561 } while (current > end);
1385 0 5561 if (!new_prefix) {
1401 442 5119 if (current == 0xFFFFFFFF) {
1439 15995 35 while (n128_cmp(begin, end) <= 0) {
1440 0 15995 if (*pcount == 128) {
1448 51 15944 zeroes = ((zeroes == INT_MAX) ? (unsigned) iplen : zeroes) - 1;
1451 1303849 15995 for (i = 0; i < ((int) zeroes + 1); i++) {
1463 3035 15995 } while (n128_cmp(¤t, end) > 0);
1472 0 15995 if (!new_prefix) {
1491 376 15619 if (res == INT_MAX) {
1523 2 921 if (!version) {
1528 1 920 if (strlen(begin) != strlen(end)) {
1534 1 919 if (!iplen) {
1538 513 406 if (version == 4) {
1577 0 11 if (!res) {
1578 0 0 for (i = 0; i < pcount; i++) {
1584 1 10 if (pcount == 0) {
1588 1 9 if (pcount > 1) {
1589 32 1 for (i = 0; i < pcount; i++) {
1597 4 5 : MAX_IPV6_RANGE_STR_LEN - 1;
1598 0 9 if (len > max) {
1628 2 5 if (n128_cmp(e1, b2)) {
1657 1 6 if (e1 + 1 != b2) {
1701 1 13 if (!version) {
1705 7 6 } else if (version == 4) {
1706 25 6 for (i = 0; i < 4; i++) {
1707 1 24 if (strlen(addr_args[i]) != 32) {
1720 21 5 for (i = 0; i < 4; i++) {
1721 1 20 if (strlen(addr_args[i]) != 128) {
1735 1 10 if (res == 0) {
1738 2 8 if (res == 160) {
1742 1 7 if (res == 161) {
1773 1131 869 if (ipversion == 4) {
1775 4 1127 if (res == 0) {
1779 4508 1127 for (j = 0; j < 4; j++) {
1780 36064 4508 for (i = 0; i < 8; i++) {
1781 21708 14356 buf[(j * 8) + i] =
1789 33749 869 while ((c = ip[j])) {
1790 27701 6048 if (c != ':') {
1795 4 865 if (ncount != 32) {
1801 33637 862 for (j = 0; ip[j] != '\0'; j++) {
1802 6031 27606 if (ip[j] == ':') {
1809 3 27603 if (y == -1) {
1813 110412 27603 for (k = 0; k < 4; k++) {
1814 67144 43268 buf[ (i * 4) + k ] =
1837 4 965 if (!res) {
1863 11 742 if (!res) {
1867 2968 742 for (i = 0; i < 4; i++) {
1895 969 753 : NI_ip_expand_address_ipv6(ip, buf);
1921 13 1 if ((len < 0) || (len > 32)) {
1 12 if ((len < 0) || (len > 32)) {
1927 1 11 if (!res) {
1931 28 11 for (i = (quads - 1); i >= 0; i--) {
1963 18 1 if ((len < 0) || (len > 128)) {
1 17 if ((len < 0) || (len > 128)) {
1969 1 16 if (!res) {
1973 110 16 for (i = (len - 1); i >= 0; i--) {
1975 58 52 shift = !(i % 2) * 4;
1994 1 34 if (!ipversion) {
1997 1 34 if (!ipversion) {
2003 14 20 if (ipversion == 4) {
2005 19 1 } else if (ipversion == 6) {
2036 54 70 if (c != '/') {
2043 70 0 if (STRTOL_FAILED(clen, slash, endptr)) {
0 70 if (STRTOL_FAILED(clen, slash, endptr)) {
0 0 if (STRTOL_FAILED(clen, slash, endptr)) {
12 58 if (STRTOL_FAILED(clen, slash, endptr)) {
3 9 if (STRTOL_FAILED(clen, slash, endptr)) {
2046 8 59 if (*endptr == ',') {
2048 3 56 } else if (endptr != (slash + strlen(slash))) {
2056 3 61 if (!res) {
2062 8 53 if (addcst) {
2098 42 53 if (c != '/') {
2105 53 0 if (STRTOL_FAILED(clen, slash, endptr)) {
0 53 if (STRTOL_FAILED(clen, slash, endptr)) {
0 0 if (STRTOL_FAILED(clen, slash, endptr)) {
31 22 if (STRTOL_FAILED(clen, slash, endptr)) {
1 30 if (STRTOL_FAILED(clen, slash, endptr)) {
2108 5 47 if (*endptr == ',') {
2110 2 45 } else if (endptr != (slash + strlen(slash))) {
2118 3 47 if (!res) {
2124 5 42 if (addcst) {
2164 23930 157 while ((c = *ip)) {
2165 821 23109 if (isspace(c)) {
2168 22131 978 if (i && (c == '/') && (!slash)) {
124 22007 if (i && (c == '/') && (!slash)) {
112 12 if (i && (c == '/') && (!slash)) {
2176 45 112 if (islash < 1) {
2183 63 49 if (ipversion == 4) {
2185 0 63 if (!res) {
2194 48 1 } else if (ipversion == 6) {
2196 0 48 if (!res) {
2237 26852 84 while ((c = *str)) {
2238 836 26016 if (c == separator) {
2240 17 819 if (!break_char) {
2241 3 14 if (!i) {
2248 856 25160 } else if (isspace(c)) {
2249 849 7 if (!break_char) {
2259 84 833 if (!hit_separator) {
2265 1 832 if (c == '\0') {
2269 1656 1 while ((c = *str) && (isspace(c))) {
825 831 while ((c = *str) && (isspace(c))) {
2273 1 831 if (c == '\0') {
2303 54 812 if (!res) {
2311 1 811 if (!ipversion) {
2319 1 810 if (!res) {
2324 0 810 if (!res) {
2351 0 15 if (!res) {
2360 14 1 if (STRTOUL_FAILED(addnum, num, endptr)) {
1 13 if (STRTOUL_FAILED(addnum, num, endptr)) {
0 2 if (STRTOUL_FAILED(addnum, num, endptr)) {
0 13 if (STRTOUL_FAILED(addnum, num, endptr)) {
0 0 if (STRTOUL_FAILED(addnum, num, endptr)) {
2363 1 12 if (addnum > 0xFFFFFFFF) {
2393 0 4 if (!res) {
2400 2 2 if (!res) {
2431 35 19 if (!res) {
2469 9 26 if (!ipversion) {
2474 0 26 if (!res) {
2499 112 866 if (res >= 0) {
2504 812 54 if (res >= 0) {
2509 19 35 if (res >= 0) {
2514 35 0 if (res >= 0) {
2541 3 6 if (!res) {
2545 1 5 sprintf(buf, "%s - %s", ip1buf,
2565 50 2 if ((len < 0) || (len > 32)) {
1 49 if ((len < 0) || (len > 32)) {
2568 2 47 if (strlen(ip) > (MAX_IPV4_RANGE_STR_LEN - 1)) {
2573 42 5 dotcount = (len == 0) ? 1 : ((len / 8) + (!(len % 8) ? 0 : 1));
2574 108 33 while (dotcount--) {
2576 14 94 if (c == NULL) {
2580 94 0 if (*(c + 1) != '\0') {
2586 0 47 if (buflen > maxlen) {
2621 1 18 if (!version) {
2627 1 17 if (version == 4) {
2633 1 16 if (!res) {
2637 128 16 for (i = 0; i < 16; i += 2) {
2638 94 34 if ((ipv6[i] == 0) && (ipv6[i + 1] == 0)) {
72 22 if ((ipv6[i] == 0) && (ipv6[i + 1] == 0)) {
2639 26 46 if (!in_ws) {
2652 64 16 for (i = 0; i < 4; i++) {
2658 20 44 if (ws_count[i] > largest && ws_count[i] > 1) {
14 6 if (ws_count[i] > largest && ws_count[i] > 1) {
2664 85 16 for (i = 0; i < 16; i += 2) {
2665 53 32 if ((largest_index != -1) && (i == ws_start[largest_index])) {
12 41 if ((largest_index != -1) && (i == ws_start[largest_index])) {
2666 2 10 if (i == 0) {
2675 59 14 if (i < 14) {
2700 2 145 if (!slash) {
2705 144 1 if ((len == 0) || (len > (MAX_IPV6_STR_LEN - 1))) {
2 142 if ((len == 0) || (len > (MAX_IPV6_STR_LEN - 1))) {
2710 1 141 if (*c == '\0') {
2717 141 0 if (STRTOL_FAILED(num, c, endptr)) {
1 140 if (STRTOL_FAILED(num, c, endptr)) {
0 1 if (STRTOL_FAILED(num, c, endptr)) {
37 103 if (STRTOL_FAILED(num, c, endptr)) {
1 36 if (STRTOL_FAILED(num, c, endptr)) {
2720 1 138 if (num < 0) {
2752 8 8 hash = get_hv(
2756 0 16 if (!hash) {
2763 268 16 while ((entry = hv_iternext(hash))) {
2765 205 63 if (keylen > current_keylen) {
2766 13 192 if (!strncmp(key, ip, keylen)) {
2769 13 0 typestr = SvPV(value, len);
2770 1 12 if (len > (MAX_TYPE_STR_LEN - 1)) {
2779 10 6 if (current_keylen) {
2783 3 3 if (version == 4) {
2807 1 8 if (!version) {
2816 2 6 if (mask_len != iplen) {
2824 99 4 while (*c != '\0') {
2825 34 65 if ((*c == '1') && (state == 0)) {
33 1 if ((*c == '1') && (state == 0)) {
2829 64 2 if (*c == '0') {
2830 3 61 if (state == 0) {
2856 1 21 if (!version) {
2861 1 20 if (!NI_ip_expand_address(ip, version, buf)) {
2865 0 20 if (!NI_ip_iptobin(ip, version, bitstr1)) {
2869 18 2 bitstr1[(version == 4) ? 32 : 128] = '\0';
2871 1 19 if (!NI_ip_check_prefix(bitstr1, len, version)) {
2877 17 2 bitstr2[(version == 4) ? 32 : 128] = '\0';
2879 0 19 if (!NI_ip_bintoip(bitstr2, version, buf)) {
2898 3 5 if (c == NULL) {
2905 1 7 if (len > (MAX_IPV4_STR_LEN - 1)) {
2908 5 3 if ((len > 0) && NI_ip_is_ipv4(c)) {
4 1 if ((len > 0) && NI_ip_is_ipv4(c)) {