[Git][NTPsec/ntpsec][master] Remove dead code.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Jun 7 13:03:43 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
7505960d by Eric S. Raymond at 2016-06-07T09:03:08-04:00
Remove dead code.

The third loop on i that was here before this commit - this:

	for (; i < ipbytes; i++) {
		if (p[i] != 0)
			return (ISC_R_MASKNONCONTIG);
		i++;
	}

could never be reached, because at the end of the second loop it is
necessarily true that either an error return has occurred or i >= ipbytes.

Harmless bug, but the dead code caused a compiler warning under clang.
Mentioned in GitLab issue #71.

- - - - -


1 changed file:

- libisc/netaddr.c


Changes:

=====================================
libisc/netaddr.c
=====================================
--- a/libisc/netaddr.c
+++ b/libisc/netaddr.c
@@ -139,11 +139,6 @@ isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) {
 			return (ISC_R_MASKNONCONTIG);
 		i++;
 	}
-	for (; i < ipbytes; i++) {
-		if (p[i] != 0)
-			return (ISC_R_MASKNONCONTIG);
-		i++;
-	}
 	*lenp = nbytes * 8 + nbits;
 	return (ISC_R_SUCCESS);
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/7505960de03c949f213f76fdf0d2ea345a7895ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160607/6fc4419e/attachment.html>


More information about the vc mailing list