AZero13
AZero13
This assignment is redundant, as the assignment to prev from p1 happens after the if statement anyway. This was found by clang-tidy emitting the following warning: "Value stored to 'prev'...
This makes the code cleaner anyway and avoids branching.
It clarifies the intent and saves a function call.
The format value has to be a string literal, every time. Otherwise, you are not using these functions correctly. To reinforce this fact, I put __restrict over every non-contrib example...
Checking for an error string is the proper step, rather than checking for 0. Have an error string for consistency.
Every case has been proven to be safe as they were not even used to begin with are not used as callbacks or as part of an API.
Especially when said counters/variables are never intended to go below 0.
if (ret != 0) free(response->public_key); is dead code; the very last operation before the memcpy and the setting of ret to 0 is the malloc of response->public_key, which means response->public_key...
This is so that we don't even have to bother calling strdup if the first malloc fails, and if the strdup fails, we only free fix_prop.
fputc is meant for single characters, fputs is for strings.