]> granicus.if.org Git - postgresql/commit
Don't #include utils/palloc.h in common/fe_memutils.h.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Apr 2014 18:14:28 +0000 (14:14 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Apr 2014 18:14:28 +0000 (14:14 -0400)
commit528c454b2ada89ca0f0cd9a64f939e775b55b879
tree6cb9277a7bc417afe27c035f1bb9e8406fb85734
parent39b0c7681e465f3e486ca2a5d13fbbafbe25cb1a
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.
src/common/psprintf.c
src/include/common/fe_memutils.h
src/include/utils/palloc.h