Re: xmalloc => pg_malloc

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: xmalloc => pg_malloc
Date: 2012-10-04 04:27:33
Message-ID: 1349324853.23971.2.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2012-10-02 at 12:02 -0400, Tom Lane wrote:
> While looking around to fix the pg_malloc(0) issue, I noticed that
> various other pieces of code such as pg_basebackup have essentially
> identical functions, except they're called xmalloc(). I propose to
> standardize all these things on this set of names:
>
> pg_malloc
> pg_malloc0 (for malloc-and-zero behavior)
> pg_calloc (randomly different API for pg_malloc0)
> pg_realloc
> pg_free
> pg_strdup
>
> Any objections?

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-10-04 04:36:00 Re: xmalloc => pg_malloc
Previous Message Peter Eisentraut 2012-10-04 03:24:31 Re: [PATCH] Make pg_basebackup configure and start standby [Review]