Skip to content

Commit d597061

Browse files
author
Commitfest Bot
committed
[CF 5807] Cleanup gcc trick with varattrib_1b_e in VARATT_EXTERNAL_GET_POINTER()
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5807 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/[email protected] Author(s): Michael Paquier
2 parents 84ce258 + b4327a1 commit d597061

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/include/access/detoast.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@
1414

1515
/*
1616
* Macro to fetch the possibly-unaligned contents of an EXTERNAL datum
17-
* into a local "struct varatt_external" toast pointer. This should be
18-
* just a memcpy, but some versions of gcc seem to produce broken code
19-
* that assumes the datum contents are aligned. Introducing an explicit
20-
* intermediate "varattrib_1b_e *" variable seems to fix it.
17+
* into a local "struct varatt_external" toast pointer.
2118
*/
2219
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr) \
2320
do { \
24-
varattrib_1b_e *attre = (varattrib_1b_e *) (attr); \
25-
Assert(VARATT_IS_EXTERNAL(attre)); \
26-
Assert(VARSIZE_EXTERNAL(attre) == sizeof(toast_pointer) + VARHDRSZ_EXTERNAL); \
27-
memcpy(&(toast_pointer), VARDATA_EXTERNAL(attre), sizeof(toast_pointer)); \
21+
Assert(VARATT_IS_EXTERNAL(attr)); \
22+
Assert(VARSIZE_EXTERNAL(attr) == sizeof(toast_pointer) + VARHDRSZ_EXTERNAL); \
23+
memcpy(&(toast_pointer), VARDATA_EXTERNAL(attr), sizeof(toast_pointer)); \
2824
} while (0)
2925

3026
/* Size of an EXTERNAL datum that contains a standard TOAST pointer */

0 commit comments

Comments
 (0)