On 12.02.2013 16:55, Alvaro Herrera wrote:
Create libpgcommon, and move pg_malloc et al to it

libpgcommon is a new static library to allow sharing code among the
various frontend programs and backend; this lets us eliminate duplicate
implementations of common routines.  We avoid libpgport, because that's
intended as a place for porting issues; per discussion, it seems better
to keep them separate.

The first use case, and the only implemented by this patch, is pg_malloc
and friends, which many frontend programs were already using.

At the same time, we can use this to provide palloc emulation functions
for the frontend; this way, some palloc-using files in the backend can
also be used by the frontend cleanly.  To do this, we change palloc() in
the backend to be a function instead of a macro on top of
MemoryContextAlloc().  This was previously believed to cause loss of
performance, but this implementation has been tweaked by Tom and Andres
so that on modern compilers it provides a slight improvement over the
previous one.

The new header file, fe_memutils.h, is not installed anywhere by "make install". That makes #include "postgres_fe.h" to fail in any program compiled out-of-tree, with pgxs.

Where should it be installed? postgres_fe.h and port.h are installed to include/internal, so that would seem logical. I wonder what the "internal" actually means there, though. If we want to encourage frontend programs to use these, "internal" doesn't sound right.

- Heikki


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to