bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unnecessary {de,}alloc wrappers?


From: Ondrej Oprala
Subject: Re: unnecessary {de,}alloc wrappers?
Date: Tue, 01 Apr 2014 23:34:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]