diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-31 19:41:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-31 19:41:37 +0000 |
commit | 85d02a6586012edc385a420ebaca1c8ce4e93390 (patch) | |
tree | 4331782a9095429f06b9da7b200538d596d08380 /src/include/access/tupmacs.h | |
parent | 8abb0110479382b1873715052933f600d682654c (diff) |
Redefine Datum as uintptr_t, instead of unsigned long.
This is more in keeping with modern practice, and is a first step towards
porting to Win64 (which has sizeof(pointer) > sizeof(long)).
Tsutomu Yamada, Magnus Hagander, Tom Lane
Diffstat (limited to 'src/include/access/tupmacs.h')
-rw-r--r-- | src/include/access/tupmacs.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h index 824adc9b7be..a1828470e26 100644 --- a/src/include/access/tupmacs.h +++ b/src/include/access/tupmacs.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/tupmacs.h,v 1.36 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/tupmacs.h,v 1.37 2009/12/31 19:41:35 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -100,7 +100,8 @@ */ #define att_align_datum(cur_offset, attalign, attlen, attdatum) \ ( \ - ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? (long) (cur_offset) : \ + ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \ + (intptr_t) (cur_offset) : \ att_align_nominal(cur_offset, attalign) \ ) @@ -115,12 +116,13 @@ * aligned 4-byte length word; in either case we need not align.) * * Note: some callers pass a "char *" pointer for cur_offset. This is - * a bit of a hack but works OK on all known platforms. It ought to be - * cleaned up someday, though. + * a bit of a hack but should work all right as long as intptr_t is the + * correct width. */ #define att_align_pointer(cur_offset, attalign, attlen, attptr) \ ( \ - ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? (long) (cur_offset) : \ + ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \ + (intptr_t) (cur_offset) : \ att_align_nominal(cur_offset, attalign) \ ) @@ -142,7 +144,7 @@ #define att_align_nominal(cur_offset, attalign) \ ( \ ((attalign) == 'i') ? INTALIGN(cur_offset) : \ - (((attalign) == 'c') ? (long) (cur_offset) : \ + (((attalign) == 'c') ? (intptr_t) (cur_offset) : \ (((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \ ( \ AssertMacro((attalign) == 's'), \ |