Fix another place that was assuming that a local variable declared as
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 1 Mar 2008 19:26:28 +0000 (19:26 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 1 Mar 2008 19:26:28 +0000 (19:26 +0000)
"struct varlena" would be at least word-aligned.  Per buildfarm results
from gypsy_moth.  I did a little bit of trawling for other instances of
this coding pattern, and didn't find any; but if we turn up any more
of them I think we'd better revert the "char [4]" patch and find another
way of making tuptoaster.c alignment-safe.

src/backend/storage/large_object/inv_api.c

index e506c6a2e4b33d8bf87e82eb2c4b9a8681ccf816..80a4048d7f13d541691b73159f946ae57a48ea7e 100644 (file)
@@ -516,7 +516,8 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
        struct
        {
                bytea           hdr;
-               char            data[LOBLKSIZE];
+               char            data[LOBLKSIZE];        /* make struct big enough */
+               int32           align_it;       /* ensure struct is aligned well enough */
        }                       workbuf;
        char       *workb = VARDATA(&workbuf.hdr);
        HeapTuple       newtup;
@@ -707,7 +708,8 @@ inv_truncate(LargeObjectDesc *obj_desc, int len)
        struct
        {
                bytea           hdr;
-               char            data[LOBLKSIZE];
+               char            data[LOBLKSIZE];        /* make struct big enough */
+               int32           align_it;       /* ensure struct is aligned well enough */
        }                       workbuf;
        char       *workb = VARDATA(&workbuf.hdr);
        HeapTuple       newtup;