bug-bash
[Top][All Lists]
Advanced

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

Re: unnecessary {de,}alloc wrappers?


From: Chet Ramey
Subject: Re: unnecessary {de,}alloc wrappers?
Date: Tue, 01 Apr 2014 16:03:17 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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