phorward / unicc

LALR parser generator targetting C, C++, Python, JavaScript, JSON and XML
MIT License
59 stars 9 forks source link

Remove unnecessary null pointer checks #17

Closed elfring closed 3 years ago

elfring commented 5 years ago

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

phorward commented 5 years ago

Thanks for pointing this out. I was sure that this is not standardized. I've removed both conditions in 59aa050, maybe there are some more. The v1.7 release will come together with the next target language, which hopefully is Rust.

elfring commented 5 years ago

Thanks for your small source code improvement.

…, maybe there are some more.

Would you like to take another look at remaining update candidates?

phorward commented 5 years ago

Hi, I've fixed your proposed positions in the code, according to some more with c203929. Let me know if you find more.

elfring commented 5 years ago

Thanks for another source code improvement.


Would you eventually like to check by the software “Coccinelle” (also with the help of a variant from the following script) if any interesting update candidates were accidentally left over?

@Remove_unnecessary_pointer_checks@
expression x;
@@
-if (\(x != 0 \| x != NULL\))
    free(x);
phorward commented 5 years ago

OK i can do that right before the 1.7 release currently under development. I'm letting this issue open until then.

phorward commented 3 years ago

Will close this now. UniCC will be abandoned.