Hi Michael, On Thu, Oct 10, 2024 at 10:27:23AM +0000, Michael Pratt wrote: > These Linux Standard Base functions are not available > on all systems that are capable of building Linux and ELFs. > > The difference is negligible for simple printing to stdout. > > POSIX also states for the similar putc_unlocked(): > > These functions can safely be used in a multi-threaded program > if and only if they are called while the invoking thread owns > the (FILE *) object, as is the case after a successful call > to the flockfile() or ftrylockfile() functions. > > and > > These unlocked versions can be safely used > only within explicitly locked program regions, > using exported locking primitives. > > and this was never done. > > There is inconsistent use of fputc_unlocked() > mixed with putc_unlocked() and putchar_unlocked(), > so consistently use the safer fputc() instead.
I agree the use of the _unlocked variants is inconsistent and it would be better to consistently use the standard versions. But shouldn't we simply replace putchar_unlocked with putchar instead of using fputc (c, stdout)? Cheers, Mark