Remove unnecessary null pointer checks
elfring opened this issue · 5 comments
elfring commented
An extra null pointer check is not needed in functions like the following.
eriknyquist commented
Thanks for that, good point
eriknyquist commented
fixed
54e7875
elfring commented
Thanks for your small source code improvement.
Were any update candidates left over for such a change pattern?
eriknyquist commented
No, the check in rxvm_free serves another purpose besides protecting the free(). If compiled->simple is non-NULL, then I know that compiled->exe was never allocated so I don't need to traverse/free it. It needs to stay.
elfring commented
How do you think about to integrate the following small change?
for (i = 0; i < compiled->size; i++) {
- if (compiled->exe[i].ccs != NULL)
- free(compiled->exe[i].ccs);
+ free(compiled->exe[i].ccs);
}