summaryrefslogtreecommitdiff
path: root/src/common/controldata_utils.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-12-08 14:30:01 +0100
committerPeter Eisentraut <peter@eisentraut.org>2022-12-15 10:10:32 +0100
commit75f49221c22286104f032827359783aa5f4e6646 (patch)
treeb4ac92eb6c557b4fd1ef6eda35ce9943564aba11 /src/common/controldata_utils.c
parent2613dec4ed67c4a963d987cbd29284e0634b65c9 (diff)
Static assertions cleanup
Because we added StaticAssertStmt() first before StaticAssertDecl(), some uses as well as the instructions in c.h are now a bit backwards from the "native" way static assertions are meant to be used in C. This updates the guidance and moves some static assertions to better places. Specifically, since the addition of StaticAssertDecl(), we can put static assertions at the file level. This moves a number of static assertions out of function bodies, where they might have been stuck out of necessity, to perhaps better places at the file level or in header files. Also, when the static assertion appears in a position where a declaration is allowed, then using StaticAssertDecl() is more native than StaticAssertStmt(). Reviewed-by: John Naylor <john.naylor@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/flat/941a04e7-dd6f-c0e4-8cdf-a33b3338cbda%40enterprisedb.com
Diffstat (limited to 'src/common/controldata_utils.c')
-rw-r--r--src/common/controldata_utils.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/common/controldata_utils.c b/src/common/controldata_utils.c
index 2d1f35bbd18..5c654746fae 100644
--- a/src/common/controldata_utils.c
+++ b/src/common/controldata_utils.c
@@ -149,14 +149,6 @@ update_controlfile(const char *DataDir,
char buffer[PG_CONTROL_FILE_SIZE];
char ControlFilePath[MAXPGPATH];
- /*
- * Apply the same static assertions as in backend's WriteControlFile().
- */
- StaticAssertStmt(sizeof(ControlFileData) <= PG_CONTROL_MAX_SAFE_SIZE,
- "pg_control is too large for atomic disk writes");
- StaticAssertStmt(sizeof(ControlFileData) <= PG_CONTROL_FILE_SIZE,
- "sizeof(ControlFileData) exceeds PG_CONTROL_FILE_SIZE");
-
/* Update timestamp */
ControlFile->time = (pg_time_t) time(NULL);