From owner-freebsd-current@FreeBSD.ORG Wed Oct 13 12:50:34 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4EEF416A4DA for ; Wed, 13 Oct 2004 12:50:34 +0000 (GMT) Received: from saltmine.radix.net (saltmine.radix.net [207.192.128.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id D858343D39 for ; Wed, 13 Oct 2004 12:50:27 +0000 (GMT) (envelope-from dickey@saltmine.radix.net) Received: from saltmine.radix.net (localhost [127.0.0.1]) by saltmine.radix.net (8.12.2/8.12.2) with ESMTP id i9DCoQbC011227 for ; Wed, 13 Oct 2004 08:50:26 -0400 (EDT) Received: (from dickey@localhost) by saltmine.radix.net (8.12.2/8.12.2/Submit) id i9DCoQ81011226 for current@freebsd.org; Wed, 13 Oct 2004 08:50:26 -0400 (EDT) Date: Wed, 13 Oct 2004 08:50:26 -0400 From: Thomas Dickey To: current@freebsd.org Message-ID: <20041013125026.GA10241@saltmine.radix.net> References: <20041013122854.GA53717@webcom.it> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <20041013122854.GA53717@webcom.it> User-Agent: Mutt/1.3.27i Subject: Re: nitpicking on strcasestr.c X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2004 12:50:34 -0000 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 13, 2004 at 02:28:54PM +0200, Andrea Campi wrote: =20 > We have two calls to tolower(); the first doesn't cast the result > at all, the second one casts it to char. Shouldn't the first one be > changed also? man tolower (Solaris - but if FreeBSD differs, someone has a problem): NAME tolower - transliterate upper-case characters to lower-case SYNOPSIS #include int tolower(int c); =20 > Actually, my first feeling was to change both to unsigned char, but > I'm sure somebody could go to great lenghts to explain to me how the > code as it stands is carefully crafted to work whether chars are signed > or unsigned.... Noting that tolower() returns an int, and char's sign is unspecified, either changing the type for c (to int) or adding a cast is a good idea. Adding casts is generally a bad idea. --=20 Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net --FCuugMFkClbJLl1L Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (SunOS) Comment: For info see http://www.gnupg.org iD8DBQFBbSSLtIqByHxlDocRAkyiAJ9y6PBJyYrr7NtJmzQRrKuP6nIgkACcCYFj 2ZuCwuXask1t6r5PdCOjC7U= =q4bD -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--