[ntpsec commit] Remove some unused code.

Eric S. Raymond esr at ntpsec.org
Wed Oct 21 04:45:41 UTC 2015


Module:    ntpsec
Branch:    master
Commit:    c271f3114a3f9e47fde00b98bb6cdf38bc395c5e
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=c271f3114a3f9e47fde00b98bb6cdf38bc395c5e

Author:    Eric S. Raymond <esr at thyrsus.com>
Date:      Wed Oct 21 00:45:33 2015 -0400

Remove some unused code.

---

 libisc/netaddr.c | 38 --------------------------------------
 1 file changed, 38 deletions(-)

diff --git a/libisc/netaddr.c b/libisc/netaddr.c
index b514d5b..cab01a3 100644
--- a/libisc/netaddr.c
+++ b/libisc/netaddr.c
@@ -109,44 +109,6 @@ isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b,
 }
 
 isc_result_t
-isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen) {
-	static const unsigned char zeros[16] = { 0 };
-	unsigned int nbits, nbytes, ipbytes = 0;
-	const unsigned char *p;
-
-	switch (na->family) {
-	case AF_INET:
-		p = (const unsigned char *) &na->type.in;
-		ipbytes = 4;
-		if (prefixlen > 32)
-			return (ISC_R_RANGE);
-		break;
-	case AF_INET6:
-		p = (const unsigned char *) &na->type.in6;
-		ipbytes = 16;
-		if (prefixlen > 128)
-			return (ISC_R_RANGE);
-		break;
-	default:
-		return (ISC_R_NOTIMPLEMENTED);
-	}
-	nbytes = prefixlen / 8;
-	nbits = prefixlen % 8;
-	if (nbits != 0) {
-#ifdef __COVERITY__
-		/* head off CID 85346 */
-		assert(nbytes < ipbytes);
-#endif /* __COVERITY__ */
-		if ((p[nbytes] & (0xff>>nbits)) != 0U)
-			return (ISC_R_FAILURE);
-		nbytes++;
-	}
-	if (memcmp(p + nbytes, zeros, ipbytes - nbytes) != 0)
-		return (ISC_R_FAILURE);
-	return (ISC_R_SUCCESS);
-}
-
-isc_result_t
 isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) {
 	unsigned int nbits = 0, nbytes = 0, ipbytes = 0, i;
 	const unsigned char *p;



More information about the vc mailing list