summaryrefslogtreecommitdiff
path: root/src/backend/access/common
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-11-21 09:57:06 +0100
committerPeter Eisentraut <peter@eisentraut.org>2025-11-21 10:08:24 +0100
commit97e04c74bedb902327b89eb8a9e6aea01aabdad2 (patch)
tree3b4af6c386011bdf378b5207bd36a135042bf202 /src/backend/access/common
parent266543a62055541ddefe4e66797e0e1e4aa8705a (diff)
C11 alignas instead of unions
This changes a few union members that only existed to ensure alignments and replaces them with the C11 alignas specifier. This change only uses fundamental alignments (meaning approximately alignments of basic types), which all C11 compilers must support. There are opportunities for similar changes using extended alignments, for example in PGIOAlignedBlock, but these are not necessarily supported by all compilers, so they are kept as a separate change. Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/46f05236-d4d4-4b4e-84d4-faa500f14691%40eisentraut.org
Diffstat (limited to 'src/backend/access/common')
-rw-r--r--src/backend/access/common/toast_internals.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/backend/access/common/toast_internals.c b/src/backend/access/common/toast_internals.c
index 81dbd67c725..63b848473f8 100644
--- a/src/backend/access/common/toast_internals.c
+++ b/src/backend/access/common/toast_internals.c
@@ -287,11 +287,9 @@ toast_save_datum(Relation rel, Datum value,
bool t_isnull[3] = {0};
union
{
- struct varlena hdr;
+ alignas(int32) struct varlena hdr;
/* this is to make the union big enough for a chunk: */
char data[TOAST_MAX_CHUNK_SIZE + VARHDRSZ];
- /* ensure union is aligned well enough: */
- int32 align_it;
} chunk_data;
int32 chunk_size;