Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/usr.sbin/flashctl



> Module Name:    src
> Committed By:   rillig
> Date:           Sun May 12 19:03:55 UTC 2024
> 
> Modified Files:
>         src/usr.sbin/flashctl: flashctl.c
> 
> Log Message:
> flashctl: fix lint's strict bool mode with Clang preprocessor
> 
> Treating the return value from the <ctype.h> character classification
> functions as an 'int' is neither elegant nor idiomatic, but it works for
> now.
> 
> -               if (!isxdigit((unsigned char)str[2]))
> +               if (isxdigit((unsigned char)str[2]) == 0)

Why is this change necessary?  Weren't you teaching lint to handle
this case without complaining?  We shouldn't change anything like

	if (!isxdigit(...))
	if (ferror(...))

to

	if (isxdigit(...) == 0)
	if (ferror(...) != 0)

The original is clearer and idiomatic code, even if it's a little
silly that the return value is declared as int and not bool
(presumably for historical reasons, if the interfaces were defined
before bool existed).


Home | Main Index | Thread Index | Old Index