mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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.
This commit is contained in:
@ -35,9 +35,9 @@ extern int seg_yydebug;
|
||||
*/
|
||||
SEG *seg_in(char *str);
|
||||
char *seg_out(SEG * seg);
|
||||
float32 seg_lower(SEG * seg);
|
||||
float32 seg_upper(SEG * seg);
|
||||
float32 seg_center(SEG * seg);
|
||||
float4 seg_lower(SEG * seg);
|
||||
float4 seg_upper(SEG * seg);
|
||||
float4 seg_center(SEG * seg);
|
||||
|
||||
/*
|
||||
** GiST support methods
|
||||
@ -138,14 +138,14 @@ seg_out(SEG * seg)
|
||||
{
|
||||
if (seg->l_ext != '-')
|
||||
{
|
||||
/* print the lower boudary if exists */
|
||||
/* print the lower boundary if exists */
|
||||
p += restore(p, seg->lower, seg->l_sigd);
|
||||
p += sprintf(p, " ");
|
||||
}
|
||||
p += sprintf(p, "..");
|
||||
if (seg->u_ext != '-')
|
||||
{
|
||||
/* print the upper boudary if exists */
|
||||
/* print the upper boundary if exists */
|
||||
p += sprintf(p, " ");
|
||||
if (seg->u_ext == '>' || seg->u_ext == '<' || seg->l_ext == '~')
|
||||
p += sprintf(p, "%c", seg->u_ext);
|
||||
@ -156,40 +156,22 @@ seg_out(SEG * seg)
|
||||
return (result);
|
||||
}
|
||||
|
||||
float32
|
||||
float4
|
||||
seg_center(SEG * seg)
|
||||
{
|
||||
float32 result = (float32) palloc(sizeof(float32data));
|
||||
|
||||
if (!seg)
|
||||
return (float32) NULL;
|
||||
|
||||
*result = ((float) seg->lower + (float) seg->upper) / 2.0;
|
||||
return (result);
|
||||
return ((float) seg->lower + (float) seg->upper) / 2.0;
|
||||
}
|
||||
|
||||
float32
|
||||
float4
|
||||
seg_lower(SEG * seg)
|
||||
{
|
||||
float32 result = (float32) palloc(sizeof(float32data));
|
||||
|
||||
if (!seg)
|
||||
return (float32) NULL;
|
||||
|
||||
*result = (float) seg->lower;
|
||||
return (result);
|
||||
return seg->lower;
|
||||
}
|
||||
|
||||
float32
|
||||
float4
|
||||
seg_upper(SEG * seg)
|
||||
{
|
||||
float32 result = (float32) palloc(sizeof(float32data));
|
||||
|
||||
if (!seg)
|
||||
return (float32) NULL;
|
||||
|
||||
*result = (float) seg->upper;
|
||||
return (result);
|
||||
return seg->upper;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user