• Tom Lane's avatar
    Don't #include utils/palloc.h in common/fe_memutils.h. · 528c454b
    Tom Lane authored
    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.
    528c454b
psprintf.c 5.33 KB