This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] ctype functions and signedness
- From: DJ Delorie <dj at redhat dot com>
- To: Michael McConville <mmcco at mykolab dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Nov 2015 19:18:14 -0500
- Subject: Re: [PATCH] ctype functions and signedness
- Authentication-results: sourceware.org; auth=none
- References: <20151116155919 dot GA13057 at thinkpad dot swarthmore dot edu>
> --- libiberty/pex-win32.c
> +++ /tmp/cocci-output-25924-3a75ca-pex-win32.c
> @@ -547,8 +547,8 @@ env_compare (const void *a_ptr, const vo
>
> do
> {
> - c1 = (unsigned char) tolower (*a++);
> - c2 = (unsigned char) tolower (*b++);
> + c1 = (unsigned char) tolower ((unsigned char)*a++);
> + c2 = (unsigned char) tolower ((unsigned char)*b++);
>
> if (c1 == '=')
> c1 = '\0';
Since the only use of a and b in this function are to pass to tolower,
changing the type of a and b to unsigned char (and updating the casts
where they're initialized) would make more sense.