From: Bruce Momjian Date: Fri, 4 Sep 1998 18:05:39 +0000 (+0000) Subject: t_bits alignment fix from Tatsuo Ishii X-Git-Tag: REL6_4_2~479 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f93281a1a19b57fc8fbd560af7f36a85efe9fe76;p=postgresql t_bits alignment fix from Tatsuo Ishii --- diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 20b075d99b..a0c98a995f 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.41 1998/09/01 04:26:39 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.42 1998/09/04 18:05:38 momjian Exp $ * * NOTES * The old interface functions have been converted to macros @@ -809,7 +809,7 @@ heap_formtuple(TupleDesc tupleDescriptor, int i; int numberOfAttributes = tupleDescriptor->natts; - len = sizeof *tuple - sizeof tuple->t_bits; + len = offsetof(HeapTuple->t_bits); for (i = 0; i < numberOfAttributes && !hasnull; i++) { @@ -957,7 +957,7 @@ heap_addheader(uint32 natts, /* max domain index */ AssertArg(natts > 0); - len = sizeof(HeapTupleData) - sizeof(tup->t_bits); + len = offsetof(HeapTuple->t_bits); hoff = len = DOUBLEALIGN(len); /* be conservative */ len += structlen; diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c index fde126fb84..87ded0f519 100644 --- a/src/backend/storage/large_object/inv_api.c +++ b/src/backend/storage/large_object/inv_api.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.38 1998/09/01 04:31:56 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.39 1998/09/04 18:05:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -916,7 +916,9 @@ inv_wrold(LargeObjectDesc *obj_desc, */ /* ntup = inv_newtuple(obj_desc, newbuf, newpage, (char *) NULL, tupbytes); - dptr = ((char *) ntup) + ntup->t_hoff - sizeof(ntup->t_bits) + sizeof(int4) + dptr = ((char *) ntup) + ntup->t_hoff - + (sizeof(HeapTupleData) - offsetof(HeapTupleData.t_bits)) + + sizeof(int4) + sizeof(fsblock->vl_len); if (obj_desc->offset > obj_desc->lowbyte) { @@ -996,7 +998,7 @@ inv_newtuple(LargeObjectDesc *obj_desc, char *attptr; /* compute tuple size -- no nulls */ - hoff = sizeof(HeapTupleData) - sizeof(ntup->t_bits); + hoff = offsetof(HeapTuple->t_bits); /* add in olastbyte, varlena.vl_len, varlena.vl_dat */ tupsize = hoff + (2 * sizeof(int32)) + nwrite;