On 04/01/2014 10:03 PM, Chet Ramey wrote:
On 4/1/14 1:36 PM, Ondrej Oprala wrote:
That's possible. It might also have been an attempt at further optimization
- just calling malloc if pointer == NULL, instead going through an
additional realloc call.
Either way, I find both of these code snippets very redundant.
Sure, they probably are. There are other reasons to use xfree (unwind-
protects from back in the days when free's return value varied) and a
desire to instrument malloc, but they probably are somewhat redundant.
The question is what's to be gained by this kind of micro-optimization.
Chet
Well, it's also a matter of clean code, isn't it? Although yes, there are
no real reasons to change it; in the end it might well save some time in
the (very) long run.
Also, I don't see any reasons against it.
Ondrej