Subject: Re: CVS commit: src/common/lib/libc/string
To: Martin Husemann <martin@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: source-changes
Date: 01/09/2008 09:59:27
On Tue, 08 Jan 2008, Martin Husemann wrote:
> Modified Files:
> src/common/lib/libc/string: memchr.c strchr.c strrchr.c
>
> Log Message:
> When passing char (or unsigned char) arguments as int, assign them to a
> temporary char (resp. unsigned char) before comparing, to force truncation
> to the proper domain. This makes the coresponding regression tests succeed.
Wouldn't casts have had the same effect? e.g.:
if (*p == (unsigned char)c) ...
--apb (Alan Barrett)