aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/float.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-13 07:35:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-13 07:35:40 +0000
commitf2d120532207b8873a5e74e7350dd2904f377289 (patch)
tree992c89e023c4b29b42bf4fd6563de91f8d6ec8ca /src/backend/utils/adt/float.c
parent8f057d971d663fff9bbb2ae7d053bf71cf09b4a2 (diff)
downloadpostgresql-f2d120532207b8873a5e74e7350dd2904f377289.tar.gz
postgresql-f2d120532207b8873a5e74e7350dd2904f377289.zip
Another batch of fmgr updates. I think I have gotten all old-style
functions that take pass-by-value datatypes. Should be ready for port testing ...
Diffstat (limited to 'src/backend/utils/adt/float.c')
-rw-r--r--src/backend/utils/adt/float.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 93800b067d8..428fb5bf2c4 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.59 2000/06/08 22:37:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.60 2000/06/13 07:35:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,12 +48,11 @@
*/
#include <ctype.h>
#include <errno.h>
-
#include <float.h> /* faked on sunos4 */
-
#include <math.h>
#include "postgres.h"
+
#ifdef HAVE_LIMITS_H
#include <limits.h>
#ifndef MAXINT
@@ -64,6 +63,7 @@
#include <values.h>
#endif
#endif
+
#include "fmgr.h"
#include "utils/builtins.h"
@@ -844,15 +844,14 @@ dtoi2(PG_FUNCTION_ARGS)
/*
* i4tod - converts an int4 number to a float8 number
*/
-float64
-i4tod(int32 num)
+Datum
+i4tod(PG_FUNCTION_ARGS)
{
- float64 result;
-
- result = (float64) palloc(sizeof(float64data));
+ int32 num = PG_GETARG_INT32(0);
+ float8 result;
- *result = num;
- return result;
+ result = num;
+ PG_RETURN_FLOAT8(result);
}
@@ -909,15 +908,14 @@ ftoi2(PG_FUNCTION_ARGS)
/*
* i4tof - converts an int4 number to a float8 number
*/
-float32
-i4tof(int32 num)
+Datum
+i4tof(PG_FUNCTION_ARGS)
{
- float32 result;
-
- result = (float32) palloc(sizeof(float32data));
+ int32 num = PG_GETARG_INT32(0);
+ float4 result;
- *result = num;
- return result;
+ result = num;
+ PG_RETURN_FLOAT4(result);
}