Re: xmalloc => pg_malloc - Mailing list pgsql-hackers

From Tom Lane
Subject Re: xmalloc => pg_malloc
Date
Msg-id 15552.1349325360@sss.pgh.pa.us
Whole thread Raw
In response to Re: xmalloc => pg_malloc  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: xmalloc => pg_malloc  (Jon Nelson <jnelson+pgsql@jamponi.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> xmalloc, xstrdup, etc. are pretty common names for functions that do
> alloc-or-die (another possible naming scheme ;-) ).  The naming
> pg_malloc etc. on the other hand suggests that the allocation is being
> done in a PostgreSQL-specific way, and anyway sounds too close to
> palloc.

> So I'd be more in favor of xmalloc <= pg_malloc.

Meh.  The fact that other people use that name is not really an
advantage from where I sit.  I'm concerned about possible name
collisions, eg in libraries loaded into the backend.

There are probably not any actual risks of collision right now, given
that all these functions are currently in our client-side programs ---
but it's foreseeable that we might use this same naming convention in
more-exposed places in future.  In fact, somebody was already proposing
creating such functions in the core backend.

But having said that, I'm not absolutely wedded to these names; they
were just the majority of existing cases.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: xmalloc => pg_malloc
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: [PATCH] Make pg_basebackup configure and start standby [Review]