@@ -35,12 +35,14 @@ extern int seg_yydebug;
3535*/
3636PG_FUNCTION_INFO_V1 (seg_in );
3737PG_FUNCTION_INFO_V1 (seg_out );
38+ PG_FUNCTION_INFO_V1 (seg_size );
3839PG_FUNCTION_INFO_V1 (seg_lower );
3940PG_FUNCTION_INFO_V1 (seg_upper );
4041PG_FUNCTION_INFO_V1 (seg_center );
4142
4243Datum seg_in (PG_FUNCTION_ARGS );
4344Datum seg_out (PG_FUNCTION_ARGS );
45+ Datum seg_size (PG_FUNCTION_ARGS );
4446Datum seg_lower (PG_FUNCTION_ARGS );
4547Datum seg_upper (PG_FUNCTION_ARGS );
4648Datum seg_center (PG_FUNCTION_ARGS );
@@ -81,7 +83,6 @@ boolseg_over_right(SEG * a, SEG * b);
8183SEG * seg_union (SEG * a ,SEG * b );
8284SEG * seg_inter (SEG * a ,SEG * b );
8385void 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)
717718return ;
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