1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-24 10:47:04 +03:00
Tom Lane 0d79c0a8cc Make various variables const (read-only).
These changes should generally improve correctness/maintainability.
A nice side benefit is that several kilobytes move from initialized
data to text segment, allowing them to be shared across processes and
probably reducing copy-on-write overhead while forking a new backend.
Unfortunately this doesn't seem to help libpq in the same way (at least
not when it's compiled with -fpic on x86_64), but we can hope the linker
at least collects all nominally-const data together even if it's not
actually part of the text segment.

Also, make pg_encname_tbl[] static in encnames.c, since there seems
no very good reason for any other code to use it; per a suggestion
from Wim Lewis, who independently submitted a patch that was mostly
a subset of this one.

Oskari Saarenmaa, with some editorialization by me
2014-01-18 16:04:32 -05:00

43 lines
1.3 KiB
C

/*-------------------------------------------------------------------------
*
* relpath.h
* Declarations for relpath() and friends
*
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/common/relpath.h
*
*-------------------------------------------------------------------------
*/
#ifndef RELPATH_H
#define RELPATH_H
/*
* 'pgrminclude ignore' needed here because CppAsString2() does not throw
* an error if the symbol is not defined.
*/
#include "catalog/catversion.h" /* pgrminclude ignore */
#include "storage/relfilenode.h"
#define OIDCHARS 10 /* max chars printed by %u */
#define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \
CppAsString2(CATALOG_VERSION_NO)
extern const char *const forkNames[];
extern int forkname_chars(const char *str, ForkNumber *fork);
extern char *relpathbackend(RelFileNode rnode, BackendId backend,
ForkNumber forknum);
/* First argument is a RelFileNodeBackend */
#define relpath(rnode, forknum) \
relpathbackend((rnode).node, (rnode).backend, (forknum))
/* First argument is a RelFileNode */
#define relpathperm(rnode, forknum) \
relpathbackend((rnode), InvalidBackendId, (forknum))
#endif /* RELPATH_H */