From owner-freebsd-audit Thu Feb 15 17:59:35 2001 Delivered-To: freebsd-audit@freebsd.org Received: from lennier.cc.vt.edu (lennier.cc.vt.edu [198.82.161.193]) by hub.freebsd.org (Postfix) with ESMTP id 4D11437B4EC for ; Thu, 15 Feb 2001 17:59:32 -0800 (PST) Received: from mail.vt.edu (gkar.cc.vt.edu [198.82.161.190]) by lennier.cc.vt.edu (8.11.0/8.11.0) with ESMTP id f1G1xVu137401; Thu, 15 Feb 2001 20:59:31 -0500 (EST) Received: from enterprise.muriel.penguinpowered.com ([198.82.100.151]) by gkar.cc.vt.edu (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) with ESMTP id <0G8T00HT5UV68Z@gkar.cc.vt.edu>; Thu, 15 Feb 2001 20:59:30 -0500 (EST) Date: Thu, 15 Feb 2001 20:59:30 -0500 (EST) From: Mike Heffner Subject: Re: mail(1) cleanup patch In-reply-to: <20010215185629.A28636@winternet.com> To: Nathan Ahlstrom Cc: FreeBSD-audit Message-id: MIME-version: 1.0 X-Mailer: XFMail 1.4.7 on FreeBSD Content-type: multipart/signed; boundary="_=XFMail.1.4.7.FreeBSD:20010215205929:96217=_"; micalg=pgp-md5; protocol="application/pgp-signature" X-Priority: 3 (Normal) Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.4.7.FreeBSD:20010215205929:96217=_ Content-Type: text/plain; charset=us-ascii On 16-Feb-2001 Nathan Ahlstrom wrote: | | Hi Mike, | | I created a similar patch several months ago. It is not as complete | as your patch, but it does clean up some of those style bugs you mention | below and was an attempt at BDEFLAGS (IIRC -- it's been awhile). | | http://people.freebsd.org/~nra/ | | I have a couple of questions about your patches for mail. | | - Why have an upcase() call? Why not just call toupper(3) directly? | - I am a bit scared of the code in istrncpy, why not make a call to | strncpy/strlcpy and another call to tolower() ? | Well, first because that's what the other BSDs had done =). Second, for the upcase(), it allows us to do: list.c:677: if (upcase(*cp++) != upcase(*cp2++)) { list.c:728: if (upcase(*cp++) != upcase(*cp2++)) { without worrying about whether tolower() is implemented as a macro (but this isn't a problem since ours is implemented as an inline). However, this code could easily be rewritten to be safe with tolower(). As for the istrncpy(), I left it so that we wouldn't have to make two passes through the string, (once to copy, then to tolower()), but that overhead is probably negligible. Taking another look at the istrncpy(), the while loop could probably be rewritten as: while (--dsize != 0 && *src) { *dest++ = tolower(*src); src++; } -- Mike Heffner Blacksburg, VA http://filebox.vt.edu/users/mheffner --_=XFMail.1.4.7.FreeBSD:20010215205929:96217=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE6jImBFokZQs3sv5kRAjfyAKCZjnRA5nE6oQiewmUhb/YoXwaIbwCfdAP+ JY5+jvgM/uuwM+wK4IlaEDk= =gUy4 -----END PGP SIGNATURE----- --_=XFMail.1.4.7.FreeBSD:20010215205929:96217=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message