Date: Fri, 24 Oct 2014 23:25:45 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273614 - head/lib/libc/stdlib Message-ID: <201410242325.s9ONPjF8013855@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410242325.s9ONPjF8013855>