Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f93281a

Browse files
committed
t_bits alignment fix from Tatsuo Ishii
1 parent edd626c commit f93281a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/backend/access/common/heaptuple.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.41 1998/09/01 04:26:39 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.42 1998/09/04 18:05:38 momjian Exp $
1212
*
1313
* NOTES
1414
* The old interface functions have been converted to macros
@@ -809,7 +809,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
809809
int i;
810810
int numberOfAttributes = tupleDescriptor->natts;
811811

812-
len = sizeof *tuple - sizeof tuple->t_bits;
812+
len = offsetof(HeapTuple->t_bits);
813813

814814
for (i = 0; i < numberOfAttributes && !hasnull; i++)
815815
{
@@ -957,7 +957,7 @@ heap_addheader(uint32 natts, /* max domain index */
957957

958958
AssertArg(natts > 0);
959959

960-
len = sizeof(HeapTupleData) - sizeof(tup->t_bits);
960+
len = offsetof(HeapTuple->t_bits);
961961

962962
hoff = len = DOUBLEALIGN(len); /* be conservative */
963963
len += structlen;

src/backend/storage/large_object/inv_api.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.38 1998/09/01 04:31:56 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.39 1998/09/04 18:05:39 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -916,7 +916,9 @@ inv_wrold(LargeObjectDesc *obj_desc,
916916
*/
917917
/*
918918
ntup = inv_newtuple(obj_desc, newbuf, newpage, (char *) NULL, tupbytes);
919-
dptr = ((char *) ntup) + ntup->t_hoff - sizeof(ntup->t_bits) + sizeof(int4)
919+
dptr = ((char *) ntup) + ntup->t_hoff -
920+
(sizeof(HeapTupleData) - offsetof(HeapTupleData.t_bits)) +
921+
sizeof(int4)
920922
+ sizeof(fsblock->vl_len);
921923
922924
if (obj_desc->offset > obj_desc->lowbyte) {
@@ -996,7 +998,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
996998
char *attptr;
997999

9981000
/* compute tuple size -- no nulls */
999-
hoff = sizeof(HeapTupleData) - sizeof(ntup->t_bits);
1001+
hoff = offsetof(HeapTuple->t_bits);
10001002

10011003
/* add in olastbyte, varlena.vl_len, varlena.vl_dat */
10021004
tupsize = hoff + (2 * sizeof(int32)) + nwrite;

0 commit comments

Comments
 (0)