pgsql: Don't #include utils/palloc.h in common/fe_memutils.h. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Don't #include utils/palloc.h in common/fe_memutils.h.
Date
Msg-id E1We77V-0008Vc-7m@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Don't #include utils/palloc.h in common/fe_memutils.h.

This breaks the principle that common/ ought not depend on anything in the
server, not only code-wise but in the headers.  The only arguable advantage
is avoidance of duplication of half a dozen extern declarations, and even
that is rather dubious, considering that the previous coding was wrong
about which declarations to duplicate: it exposed pnstrdup() to frontend
code even though no such function is provided in fe_memutils.c.

On the same principle, don't #include utils/memutils.h in the frontend
build of psprintf.c.  This requires duplicating the definition of
MaxAllocSize, but that seems fine to me: there's no a-priori reason why
frontend code should use the same size limit as the backend anyway.

In passing, clean up some rather odd layout and ordering choices that
were imposed on palloc.h to reduce the number of #ifdefs required by
the previous approach.

Per gripe from Christoph Berg.  There's still more work to do to make
include/common/ clean, but this part seems reasonably noncontroversial.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/e4c1a496f2320f65c27c7a08288c434d8b12876a

Modified Files
--------------
src/include/common/fe_memutils.h |    8 +++++++-
src/include/utils/palloc.h       |   16 +++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Record the proper typmod for an index expression column.
Next
From: Tom Lane
Date:
Subject: pgsql: Don't #include utils/palloc.h in common/fe_memutils.h.