xmalloc_type

Russ Allbery rra at stanford.edu
Tue Aug 13 17:04:08 UTC 2002


Alex Kiernan <alexk at demon.net> writes:
> Russ Allbery <rra at stanford.edu> writes:

>> I'd like to remove all instances of NEW, COPY, and DISPOSE from the
>> source tree of CURRENT, replacing them with calls to xmalloc and
>> friends, so that we can standardize more on a coding style that looks
>> like regular C calls.  I think this is uncontroversial for COPY and
>> DISPOSE, but for NEW the current macro has a slightly different API
>> that's somewhat more reliable.

> [...]

>> Accordingly, I'd like to introduce xmalloc_type into the source tree
>> that has the same API as NEW does now, but otherwise looks like the
>> xmalloc family of macros.  Then I can retire all of the old macros

>> Does this sound like a good idea to everyone?  Opinions?

> Personally I dislike all of those macros, but I guess something
> xmalloc_type has some precedent (calloc).

> For me I'd delete the lot as I think they just obfuscate, but ultimately
> I'd not argue too hard against xmalloc_type.

By "all those macros" you mean NEW, COPY, and DISPOSE (not the xmalloc
ones), right?

Yeah, I'm kind of in that camp myself, but I also can't argue with the
fact that it's easier to mess up an xmalloc call than it would be to mess
up a call to xmalloc_type (since with the latter you have to really think
about what you're allocating and you get a type mismatch if you get it
wrong).

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list