On Wed, Oct 31, 2018 at 12:24:44PM -0400, Nathan Sidwell wrote: > On 10/31/18 11:44 AM, Marek Polacek wrote: > > > > + else if (to_free) > > > + free ((void *)to_free); > > > > free (NULL) is ok so do you really need the check? > > Probably not :) IIRC the if (X) free (X) idiom was nearby, and I didn't > feel like rocking that boat.
The if (x) free (x); idiom is useful if x is unlikely or very unlikely and the cost of the function call is measureable. But one should probably use __builtin_expect in that case... Jakub