Date: Thu, 15 Feb 2001 20:59:30 -0500 (EST) From: Mike Heffner <mheffner@vt.edu> To: Nathan Ahlstrom <nrahlstr@winternet.com> Cc: FreeBSD-audit <FreeBSD-audit@FreeBSD.ORG> Subject: Re: mail(1) cleanup patch Message-ID: <XFMail.20010215205930.mheffner@vt.edu> In-Reply-To: <20010215185629.A28636@winternet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <mheffner@vt.edu> Blacksburg, VA <mikeh@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20010215205930.mheffner>