diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-04-26 14:14:28 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-04-26 14:14:28 -0400 |
commit | 528c454b2ada89ca0f0cd9a64f939e775b55b879 (patch) | |
tree | 6cb9277a7bc417afe27c035f1bb9e8406fb85734 /src/common/psprintf.c | |
parent | 39b0c7681e465f3e486ca2a5d13fbbafbe25cb1a (diff) | |
download | postgresql-528c454b2ada89ca0f0cd9a64f939e775b55b879.tar.gz postgresql-528c454b2ada89ca0f0cd9a64f939e775b55b879.zip |
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.
Diffstat (limited to 'src/common/psprintf.c')
-rw-r--r-- | src/common/psprintf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/psprintf.c b/src/common/psprintf.c index 026040f7b76..b01e1953609 100644 --- a/src/common/psprintf.c +++ b/src/common/psprintf.c @@ -15,12 +15,19 @@ */ #ifndef FRONTEND + #include "postgres.h" + +#include "utils/memutils.h" + #else + #include "postgres_fe.h" -#endif -#include "utils/memutils.h" +/* It's possible we could use a different value for this in frontend code */ +#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ + +#endif /* |