util: suppress some uninitialized variable warnings #6659
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A couple of warnings were uncovered in #6655
This should take care of the easy ones.
The larger problem is the ctype warnings where we have a bit of a mix between using the proper
isalnum()
and rolling our own withgit__isalnum()
The posix versions take an integer in to be able to handle EOF from
fgetc()
so when a char is passed it has to be casted to unsigned so that 128-255 isn't extended to negative integers.The
git__isalnum()
function takes care of it by simply not handling characters outside of the ascii set and will behave incorrectly on systems using ISO-8859-1 or other charsets using more than 7 bits.I'm not entirely sure why we have the
git__isalnum()
functions. I assume it is to support systems wherectype.h
isn't available?In that case I think the current implementation should be used only when ctype doesn't exists.
There is also the thing where casting characters to unsigned everywhere is a bit tedious, so maybe we should change the functions to take an unsigned char in?