Reply to post:

Linus Torvalds fires off angry 'compiler-masturbation' rant

Michael Wojcik Silver badge

if(*s) free(*s);

The test is unnecessary. C (ISO 9899) has always required free() to do nothing if the argument is a null pointer. Yes, you have the overhead of a (leaf) function call, but that's a negligible price to make the source more straightforward and readable, and remove a possible source of error (like, say, someone not noticing the if-body isn't a compound statement, and trying to do something else inside it without correcting that).

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon