dgibson / dtc

Device Tree Compiler
235 stars 134 forks source link

Fix use of <ctype.h> functions #105

Closed sebhub closed 1 year ago

sebhub commented 1 year ago

The value passed to the functions shall be the value of an unsigned char or EOF. It is implementation-defined if the char type is signed or unsigned. Cast to unsigned char to avoid undefined behaviour on systems where char is signed.

This cast is already present in other parts of the code base.

Close #71.

dgibson commented 1 year ago

It seems pretty nuts to me that you can't safely use functions explicitly designed to test characters on values of type char. But I guess that's the weird history of the C library for you.

Merged.