Skip to content
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 #8

Open
elfring opened this issue Oct 15, 2017 · 5 comments
Open

Remove unnecessary null pointer checks #8

elfring opened this issue Oct 15, 2017 · 5 comments
Assignees

Comments

@elfring
Copy link

elfring commented Oct 15, 2017

An extra null pointer check is not needed in functions like the following.

@eriknyquist
Copy link
Owner

Thanks for that, good point

@eriknyquist
Copy link
Owner

fixed
54e7875

@elfring
Copy link
Author

elfring commented Oct 18, 2017

Thanks for your small source code improvement.

Were any update candidates left over for such a change pattern?

@eriknyquist
Copy link
Owner

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
Copy link
Author

elfring commented Oct 18, 2017

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);
         }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants