svn commit: r273614 - head/lib/libc/stdlib

Brooks Davis brooks at FreeBSD.org
Fri Oct 24 23:25:45 UTC 2014


Author: brooks
Date: Fri Oct 24 23:25:44 2014
New Revision: 273614
URL: https://svnweb.freebsd.org/changeset/base/273614

Log:
  Use the __DECONST macro rather than hand rolling the same thing.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/lib/libc/stdlib/lsearch.c

Modified: head/lib/libc/stdlib/lsearch.c
==============================================================================
--- head/lib/libc/stdlib/lsearch.c	Fri Oct 24 23:25:11 2014	(r273613)
+++ head/lib/libc/stdlib/lsearch.c	Fri Oct 24 23:25:44 2014	(r273614)
@@ -39,11 +39,7 @@ lwork(const void *key, const void *base,
 {
 	uint8_t *ep, *endp;
 
-	/*
-	 * Cast to an integer value first to avoid the warning for removing
-	 * 'const' via a cast.
-	 */
-	ep = (uint8_t *)(uintptr_t)base;
+	ep = __DECONST(uint8_t *, base);
 	for (endp = (uint8_t *)(ep + width * *nelp); ep < endp; ep += width) {
 		if (compar(key, ep) == 0)
 			return (ep);


More information about the svn-src-head mailing list