aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/geo_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/geo_ops.c')
-rw-r--r--src/backend/utils/adt/geo_ops.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index 0e8bb4405b2..dc6e077d6bf 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.50 2000/04/12 17:15:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.51 2000/06/13 07:35:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -4361,22 +4361,21 @@ box_circle(BOX *box)
} /* box_circle() */
-POLYGON *
-circle_poly(int npts, CIRCLE *circle)
+Datum
+circle_poly(PG_FUNCTION_ARGS)
{
+ int32 npts = PG_GETARG_INT32(0);
+ CIRCLE *circle = PG_GETARG_CIRCLE_P(1);
POLYGON *poly;
int size;
int i;
double angle;
- if (!PointerIsValid(circle))
- return NULL;
-
if (FPzero(circle->radius) || (npts < 2))
elog(ERROR, "Unable to convert circle to polygon");
size = offsetof(POLYGON, p[0]) +(sizeof(poly->p[0]) * npts);
- poly = palloc(size);
+ poly = (POLYGON *) palloc(size);
MemSet((char *) poly, 0, size); /* zero any holes */
poly->size = size;
@@ -4391,7 +4390,7 @@ circle_poly(int npts, CIRCLE *circle)
make_bound_box(poly);
- return poly;
+ PG_RETURN_POLYGON_P(poly);
}
/* poly_circle - convert polygon to circle