Skip to content

Commit 7c81d79

Browse files
committed
seg_size() has to be V1 calling convention, too.
1 parent 6e88466 commit 7c81d79

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

contrib/seg/seg.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ extern int seg_yydebug;
3535
*/
3636
PG_FUNCTION_INFO_V1(seg_in);
3737
PG_FUNCTION_INFO_V1(seg_out);
38+
PG_FUNCTION_INFO_V1(seg_size);
3839
PG_FUNCTION_INFO_V1(seg_lower);
3940
PG_FUNCTION_INFO_V1(seg_upper);
4041
PG_FUNCTION_INFO_V1(seg_center);
4142

4243
Datum seg_in(PG_FUNCTION_ARGS);
4344
Datum seg_out(PG_FUNCTION_ARGS);
45+
Datum seg_size(PG_FUNCTION_ARGS);
4446
Datum seg_lower(PG_FUNCTION_ARGS);
4547
Datum seg_upper(PG_FUNCTION_ARGS);
4648
Datum seg_center(PG_FUNCTION_ARGS);
@@ -81,7 +83,6 @@ bool seg_over_right(SEG * a, SEG * b);
8183
SEG *seg_union(SEG * a, SEG * b);
8284
SEG *seg_inter(SEG * a, SEG * b);
8385
void rt_seg_size(SEG * a, float *sz);
84-
float *seg_size(SEG * a);
8586

8687
/*
8788
** Various operators
@@ -717,16 +718,12 @@ rt_seg_size(SEG * a, float *size)
717718
return;
718719
}
719720

720-
float *
721-
seg_size(SEG * a)
721+
Datum
722+
seg_size(PG_FUNCTION_ARGS)
722723
{
723-
float *result;
724-
725-
result = (float *) palloc(sizeof(float));
726-
727-
*result = (float) Abs(a->upper - a->lower);
724+
SEG *seg = (SEG *) PG_GETARG_POINTER(0);
728725

729-
return (result);
726+
PG_RETURN_FLOAT4((float) Abs(seg->upper - seg->lower));
730727
}
731728

732729

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy