diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-09-13 11:05:07 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-09-13 11:11:45 -0400 |
commit | 0a20ff54f5e66158930d5328f89f087d4e9ab400 (patch) | |
tree | 061094ad7638e0d0be3fe007f29ed31710a75cec /src/include/commands/variable.h | |
parent | 257eb57b50f7c65467bfc2f4d579622fa13f3370 (diff) | |
download | postgresql-0a20ff54f5e66158930d5328f89f087d4e9ab400.tar.gz postgresql-0a20ff54f5e66158930d5328f89f087d4e9ab400.zip |
Split up guc.c for better build speed and ease of maintenance.
guc.c has grown to be one of our largest .c files, making it
a bottleneck for compilation. It's also acquired a bunch of
knowledge that'd be better kept elsewhere, because of our not
very good habit of putting variable-specific check hooks here.
Hence, split it up along these lines:
* guc.c itself retains just the core GUC housekeeping mechanisms.
* New file guc_funcs.c contains the SET/SHOW interfaces and some
SQL-accessible functions for GUC manipulation.
* New file guc_tables.c contains the data arrays that define the
built-in GUC variables, along with some already-exported constant
tables.
* GUC check/assign/show hook functions are moved to the variable's
home module, whenever that's clearly identifiable. A few hard-
to-classify hooks ended up in commands/variable.c, which was
already a home for miscellaneous GUC hook functions.
To avoid cluttering a lot more header files with #include "guc.h",
I also invented a new header file utils/guc_hooks.h and put all
the GUC hook functions' declarations there, regardless of their
originating module. That allowed removal of #include "guc.h"
from some existing headers. The fallout from that (hopefully
all caught here) demonstrates clearly why such inclusions are
best minimized: there are a lot of files that, for example,
were getting array.h at two or more levels of remove, despite
not having any connection at all to GUCs in themselves.
There is some very minor code beautification here, such as
renaming a couple of inconsistently-named hook functions
and improving some comments. But mostly this just moves
code from point A to point B and deals with the ensuing
needs for #include adjustments and exporting a few functions
that previously weren't exported.
Patch by me, per a suggestion from Andres Freund; thanks also
to Michael Paquier for the idea to invent guc_funcs.c.
Discussion: https://postgr.es/m/587607.1662836699@sss.pgh.pa.us
Diffstat (limited to 'src/include/commands/variable.h')
-rw-r--r-- | src/include/commands/variable.h | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/include/commands/variable.h b/src/include/commands/variable.h deleted file mode 100644 index 0e5ddcbcf37..00000000000 --- a/src/include/commands/variable.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * variable.h - * Routines for handling specialized SET variables. - * - * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * src/include/commands/variable.h - */ -#ifndef VARIABLE_H -#define VARIABLE_H - -#include "utils/guc.h" - - -extern bool check_datestyle(char **newval, void **extra, GucSource source); -extern void assign_datestyle(const char *newval, void *extra); -extern bool check_timezone(char **newval, void **extra, GucSource source); -extern void assign_timezone(const char *newval, void *extra); -extern const char *show_timezone(void); -extern bool check_log_timezone(char **newval, void **extra, GucSource source); -extern void assign_log_timezone(const char *newval, void *extra); -extern const char *show_log_timezone(void); -extern bool check_transaction_read_only(bool *newval, void **extra, GucSource source); -extern bool check_XactIsoLevel(int *newval, void **extra, GucSource source); -extern bool check_transaction_deferrable(bool *newval, void **extra, GucSource source); -extern bool check_random_seed(double *newval, void **extra, GucSource source); -extern void assign_random_seed(double newval, void *extra); -extern const char *show_random_seed(void); -extern bool check_client_encoding(char **newval, void **extra, GucSource source); -extern void assign_client_encoding(const char *newval, void *extra); -extern bool check_session_authorization(char **newval, void **extra, GucSource source); -extern void assign_session_authorization(const char *newval, void *extra); -extern bool check_role(char **newval, void **extra, GucSource source); -extern void assign_role(const char *newval, void *extra); -extern const char *show_role(void); - -#endif /* VARIABLE_H */ |