[PATCH] ctype functions and signedness

DJ Delorie dj@redhat.com
Tue Nov 17 00:18:00 GMT 2015


> --- 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.



More information about the Gcc-patches mailing list