From owner-freebsd-audit Sun Sep 2 19:35:24 2001 Delivered-To: freebsd-audit@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 9E8CC37B506; Sun, 2 Sep 2001 19:35:17 -0700 (PDT) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id f832ZGX13046; Sun, 2 Sep 2001 20:35:16 -0600 (MDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.11.3/8.11.4) with ESMTP id f832ZFh22600; Sun, 2 Sep 2001 20:35:15 -0600 (MDT) (envelope-from imp@harmony.village.org) Message-Id: <200109030235.f832ZFh22600@harmony.village.org> To: Mike Barcroft Subject: Re: users.c PATCH - please review Cc: David Hill , audit@FreeBSD.ORG In-reply-to: Your message of "Sat, 01 Sep 2001 12:58:02 EDT." <20010901125802.F85574@coffee.q9media.com> References: <20010901125802.F85574@coffee.q9media.com> <20010831160414.7125e88e.david@phobia.ms> Date: Sun, 02 Sep 2001 20:35:14 -0600 From: Warner Losh Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <20010901125802.F85574@coffee.q9media.com> Mike Barcroft writes: : David Hill writes: : > I have patched users/users.c so that it will compile under WARNS?=2. I have both attached and cut/pasted it to the message. : > Please review it. : : > diff -ru /usr/src/usr.bin/users.orig/users.c /usr/src/usr.bin/users/users.c : > --- /usr/src/usr.bin/users.orig/users.c Fri Aug 27 21:07:14 1999 : > +++ /usr/src/usr.bin/users/users.c Fri Aug 31 15:58:20 2001 : > @@ -117,5 +117,8 @@ : > scmp(p, q) : > const void *p, *q; : > { : > - return(strncmp((char *)p, (char *)q, UT_NAMESIZE)); : > + const char *const pp1 = p; : > + const char *const pp2 = q; : > + : > + return(strncmp(pp1, pp2, UT_NAMESIZE)); : > } : : Why create new local variables? Just get rid of the bogus casts. Why not just return (strncmp((const char *)p, (const char *)q, UT_NAMESIZE)); Also, const char *const is wrong. No need for the second const. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message