diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-06-15 17:25:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-06-15 17:28:26 -0400 |
commit | 7b54d7ebbd963a0a40b6ff5109ea0e3eedde534d (patch) | |
tree | d7a0cbfd83a86dc32722ec090e05aca3e477ccc9 /src/common/address.c | |
parent | 327d4c11ddbed709b3cca5bb12265f201797d569 (diff) | |
download | tor-7b54d7ebbd963a0a40b6ff5109ea0e3eedde534d.tar.gz tor-7b54d7ebbd963a0a40b6ff5109ea0e3eedde534d.zip |
Mark src/common tor_assert(0)/tor_fragile_assert() unreached for coverage
I audited this to make sure I was only marking ones that really
should be unreachable.
Diffstat (limited to 'src/common/address.c')
-rw-r--r-- | src/common/address.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/address.c b/src/common/address.c index 127e6a95bc..5cd7a8df67 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -335,7 +335,7 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr) } else if (ent->h_addrtype == AF_INET6) { tor_addr_from_in6(addr, (struct in6_addr*) ent->h_addr); } else { - tor_assert(0); /* gethostbyname() returned a bizarre addrtype */ + tor_assert(0); // LCOV_EXCL_LINE: gethostbyname() returned bizarre type } return 0; } @@ -906,8 +906,10 @@ tor_addr_is_loopback(const tor_addr_t *addr) case AF_UNSPEC: return 0; default: + /* LCOV_EXCL_START */ tor_fragile_assert(); return 0; + /* LCOV_EXCL_STOP */ } } @@ -1028,7 +1030,7 @@ tor_addr_copy_tight(tor_addr_t *dest, const tor_addr_t *src) case AF_UNSPEC: break; default: - tor_fragile_assert(); + tor_fragile_assert(); // LCOV_EXCL_LINE } } @@ -1097,6 +1099,7 @@ tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2, case AF_INET6: { if (mbits > 128) mbits = 128; + const uint8_t *a1 = tor_addr_to_in6_addr8(addr1); const uint8_t *a2 = tor_addr_to_in6_addr8(addr2); const int bytes = mbits >> 3; @@ -1112,8 +1115,10 @@ tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2, } } default: + /* LCOV_EXCL_START */ tor_fragile_assert(); return 0; + /* LCOV_EXCL_STOP */ } } else if (how == CMP_EXACT) { /* Unequal families and an exact comparison? Stop now! */ @@ -1166,8 +1171,10 @@ tor_addr_hash(const tor_addr_t *addr) case AF_INET6: return siphash24g(&addr->addr.in6_addr.s6_addr, 16); default: + /* LCOV_EXCL_START */ tor_fragile_assert(); return 0; + /* LCOV_EXCL_END */ } } |