diff options
author | Alvaro Herrera | 2008-04-18 18:43:09 +0000 |
---|---|---|
committer | Alvaro Herrera | 2008-04-18 18:43:09 +0000 |
commit | 7861d72ea204ef4085861f79f9c1749597160f72 (patch) | |
tree | d778614447739d8388ed9726b48422e623868571 /contrib/btree_gist | |
parent | b8e5581d762acceda22dd7347ed43d2e013a6df1 (diff) |
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 'contrib/btree_gist')
-rw-r--r-- | contrib/btree_gist/btree_utils_num.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/btree_gist/btree_utils_num.c b/contrib/btree_gist/btree_utils_num.c index 9798d015635..c7b41f16c1e 100644 --- a/contrib/btree_gist/btree_utils_num.c +++ b/contrib/btree_gist/btree_utils_num.c @@ -13,10 +13,11 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo { int16 i2; int32 i4; + float4 f4; DateADT dt; } v; - GBT_NUMKEY *r = (GBT_NUMKEY *) palloc(2 * tinfo->size); + GBT_NUMKEY *r = (GBT_NUMKEY *) palloc0(2 * tinfo->size); void *leaf = NULL; switch (tinfo->t) @@ -37,11 +38,14 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo v.dt = DatumGetDateADT(entry->key); leaf = &v.dt; break; + case gbt_t_float4: + v.f4 = DatumGetFloat4(entry->key); + leaf = &v.f4; + break; default: leaf = DatumGetPointer(entry->key); } - memset((void *) &r[0], 0, 2 * tinfo->size); memcpy((void *) &r[0], leaf, tinfo->size); memcpy((void *) &r[tinfo->size], leaf, tinfo->size); retval = palloc(sizeof(GISTENTRY)); |