librxvm icon indicating copy to clipboard operation
librxvm copied to clipboard

Remove unnecessary null pointer checks

Open elfring opened this issue 8 years ago • 5 comments

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

elfring avatar Oct 15 '17 18:10 elfring

Thanks for that, good point

eriknyquist avatar Oct 15 '17 18:10 eriknyquist

fixed 54e78752c84e3bb1ca0a93dcae9186d035281a2e

eriknyquist avatar Oct 18 '17 05:10 eriknyquist

Thanks for your small source code improvement.

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

elfring avatar Oct 18 '17 12:10 elfring

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.

eriknyquist avatar Oct 18 '17 20:10 eriknyquist

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

elfring avatar Oct 18 '17 20:10 elfring