diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2008-04-18 18:43:09 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2008-04-18 18:43:09 +0000 |
commit | 7861d72ea204ef4085861f79f9c1749597160f72 (patch) | |
tree | d778614447739d8388ed9726b48422e623868571 /src/include/postgres.h | |
parent | b8e5581d762acceda22dd7347ed43d2e013a6df1 (diff) | |
download | postgresql-7861d72ea204ef4085861f79f9c1749597160f72.tar.gz postgresql-7861d72ea204ef4085861f79f9c1749597160f72.zip |
Modify the float4 datatype to be pass-by-val. Along the way, remove the last
uses of the long-deprecated float32 in contrib/seg; the definitions themselves
are still there, but no longer used. fmgr/README updated to match.
I added a CREATE FUNCTION to account for existing seg_center() code in seg.c
too, and some tests for it and the neighbor functions. At the same time,
remove checks for NULL which are not needed (because the functions are declared
STRICT).
I had to do some adjustments to contrib's btree_gist too. The choices for
representation there are not ideal for changing the underlying types :-(
Original patch by Zoltan Boszormenyi, with some adjustments by me.
Diffstat (limited to 'src/include/postgres.h')
-rw-r--r-- | src/include/postgres.h | 57 |
1 files changed, 3 insertions, 54 deletions
diff --git a/src/include/postgres.h b/src/include/postgres.h index 3c4f414f643..40ecd451a85 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1995, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/postgres.h,v 1.89 2008/03/27 03:57:34 tgl Exp $ + * $PostgreSQL: pgsql/src/include/postgres.h,v 1.90 2008/04/18 18:43:09 alvherre Exp $ * *------------------------------------------------------------------------- */ @@ -546,18 +546,13 @@ extern Datum Int64GetDatum(int64 X); /* * DatumGetFloat4 * Returns 4-byte floating point value of a datum. - * - * Note: this macro hides the fact that float4 is currently a - * pass-by-reference type. Someday it may be pass-by-value. */ -#define DatumGetFloat4(X) (* ((float4 *) DatumGetPointer(X))) +extern float4 DatumGetFloat4(Datum X); /* * Float4GetDatum * Returns datum representation for a 4-byte floating point number. - * - * Note: this routine returns a reference to palloc'd space. */ extern Datum Float4GetDatum(float4 X); @@ -584,56 +579,11 @@ extern Datum Float8GetDatum(float8 X); /* - * DatumGetFloat32 - * Returns 32-bit floating point value of a datum. - * This is really a pointer, of course. - * - * XXX: this macro is now deprecated in favor of DatumGetFloat4. - * It will eventually go away. - */ - -#define DatumGetFloat32(X) ((float32) DatumGetPointer(X)) - -/* - * Float32GetDatum - * Returns datum representation for a 32-bit floating point number. - * This is really a pointer, of course. - * - * XXX: this macro is now deprecated in favor of Float4GetDatum. - * It will eventually go away. - */ - -#define Float32GetDatum(X) PointerGetDatum(X) - -/* - * DatumGetFloat64 - * Returns 64-bit floating point value of a datum. - * This is really a pointer, of course. - * - * XXX: this macro is now deprecated in favor of DatumGetFloat8. - * It will eventually go away. - */ - -#define DatumGetFloat64(X) ((float64) DatumGetPointer(X)) - -/* - * Float64GetDatum - * Returns datum representation for a 64-bit floating point number. - * This is really a pointer, of course. - * - * XXX: this macro is now deprecated in favor of Float8GetDatum. - * It will eventually go away. - */ - -#define Float64GetDatum(X) PointerGetDatum(X) - -/* * Int64GetDatumFast - * Float4GetDatumFast * Float8GetDatumFast * * These macros are intended to allow writing code that does not depend on - * whether int64, float4, float8 are pass-by-reference types, while not + * whether int64, float8 are pass-by-reference types, while not * sacrificing performance when they are. The argument must be a variable * that will exist and have the same value for as long as the Datum is needed. * In the pass-by-ref case, the address of the variable is taken to use as @@ -642,7 +592,6 @@ extern Datum Float8GetDatum(float8 X); */ #define Int64GetDatumFast(X) PointerGetDatum(&(X)) -#define Float4GetDatumFast(X) PointerGetDatum(&(X)) #define Float8GetDatumFast(X) PointerGetDatum(&(X)) |