-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary null pointer checks #276
Comments
Agreed, target platforms for Mini-XML are not old C89 (or older) compilers anymore. |
I am curious then if another software developer (besides me) can get into the mood to apply a corresponding update suggestion which could be generated by the software “Coccinelle” (also with the help of a variant from the following script). @Remove_unnecessary_pointer_checks@
expression x;
@@
-if (\(x != 0 \| x != NULL\))
free(x); |
@elfring When it comes to detecting potential coding errors or inefficient patterns, I have no problem running a search or scan. But I have a hard time “blindly” trusting a global search-and-replace of this scope since in my experience it is easy to introduce coding/logic errors that way. |
🤔 How do you think about to try a possible update generation out for the mentioned transformation pattern with the help of the semantic patch language (Coccinelle software)? |
Thanks for your small source code improvement. |
Extra null pointer checks are not needed in functions like the following.
The text was updated successfully, but these errors were encountered: