Change the float4-returning functions in contrib/seg to fmgr v1 calling
conventions. I also changed seg_in and seg_out, which was probably unnecessary, but it can't harm.
This commit is contained in:
parent
41de1d1507
commit
05ace73335
@ -33,11 +33,17 @@ extern int seg_yydebug;
|
|||||||
/*
|
/*
|
||||||
** Input/Output routines
|
** Input/Output routines
|
||||||
*/
|
*/
|
||||||
SEG *seg_in(char *str);
|
PG_FUNCTION_INFO_V1(seg_in);
|
||||||
char *seg_out(SEG * seg);
|
PG_FUNCTION_INFO_V1(seg_out);
|
||||||
float4 seg_lower(SEG * seg);
|
PG_FUNCTION_INFO_V1(seg_lower);
|
||||||
float4 seg_upper(SEG * seg);
|
PG_FUNCTION_INFO_V1(seg_upper);
|
||||||
float4 seg_center(SEG * seg);
|
PG_FUNCTION_INFO_V1(seg_center);
|
||||||
|
|
||||||
|
Datum seg_in(PG_FUNCTION_ARGS);
|
||||||
|
Datum seg_out(PG_FUNCTION_ARGS);
|
||||||
|
Datum seg_lower(PG_FUNCTION_ARGS);
|
||||||
|
Datum seg_upper(PG_FUNCTION_ARGS);
|
||||||
|
Datum seg_center(PG_FUNCTION_ARGS);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** GiST support methods
|
** GiST support methods
|
||||||
@ -98,9 +104,10 @@ int significant_digits(char *s);
|
|||||||
* Input/Output functions
|
* Input/Output functions
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
SEG *
|
Datum
|
||||||
seg_in(char *str)
|
seg_in(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
|
char *str = PG_GETARG_CSTRING(0);
|
||||||
SEG *result = palloc(sizeof(SEG));
|
SEG *result = palloc(sizeof(SEG));
|
||||||
|
|
||||||
seg_scanner_init(str);
|
seg_scanner_init(str);
|
||||||
@ -110,18 +117,16 @@ seg_in(char *str)
|
|||||||
|
|
||||||
seg_scanner_finish();
|
seg_scanner_finish();
|
||||||
|
|
||||||
return (result);
|
PG_RETURN_POINTER(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
Datum
|
||||||
seg_out(SEG * seg)
|
seg_out(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
|
SEG *seg = (SEG *) PG_GETARG_POINTER(0);
|
||||||
char *result;
|
char *result;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (seg == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
p = result = (char *) palloc(40);
|
p = result = (char *) palloc(40);
|
||||||
|
|
||||||
if (seg->l_ext == '>' || seg->l_ext == '<' || seg->l_ext == '~')
|
if (seg->l_ext == '>' || seg->l_ext == '<' || seg->l_ext == '~')
|
||||||
@ -153,25 +158,31 @@ seg_out(SEG * seg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result);
|
PG_RETURN_CSTRING(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
float4
|
Datum
|
||||||
seg_center(SEG * seg)
|
seg_center(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
return ((float) seg->lower + (float) seg->upper) / 2.0;
|
SEG *seg = (SEG *) PG_GETARG_POINTER(0);
|
||||||
|
|
||||||
|
PG_RETURN_FLOAT4(((float) seg->lower + (float) seg->upper) / 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float4
|
Datum
|
||||||
seg_lower(SEG * seg)
|
seg_lower(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
return seg->lower;
|
SEG *seg = (SEG *) PG_GETARG_POINTER(0);
|
||||||
|
|
||||||
|
PG_RETURN_FLOAT4(seg->lower);
|
||||||
}
|
}
|
||||||
|
|
||||||
float4
|
Datum
|
||||||
seg_upper(SEG * seg)
|
seg_upper(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
return seg->upper;
|
SEG *seg = (SEG *) PG_GETARG_POINTER(0);
|
||||||
|
|
||||||
|
PG_RETURN_FLOAT4(seg->upper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user