diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-08-01 18:29:35 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-08-01 18:29:35 +0000 |
commit | 463f1f5cdaecf229dcd1d3d16e969bf3a7aa9a73 (patch) | |
tree | e212492457fbf4f54cb12c160cc3f8a602256871 /src/backend/utils/adt/numeric.c | |
parent | 92bd532c1e8b65f4f4d09ffb453782b29d6d1e42 (diff) | |
download | postgresql-463f1f5cdaecf229dcd1d3d16e969bf3a7aa9a73.tar.gz postgresql-463f1f5cdaecf229dcd1d3d16e969bf3a7aa9a73.zip |
Convert all remaining float4 and float8 functions to new fmgr style.
At this point I think it'd be possible to make float4 be pass-by-value
without too much work --- and float8 too on machines where Datum is
8 bytes. Something to try when the mood strikes, anyway.
Diffstat (limited to 'src/backend/utils/adt/numeric.c')
-rw-r--r-- | src/backend/utils/adt/numeric.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index bc9a6fe6b31..a867e7f3482 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -5,7 +5,7 @@ * * 1998 Jan Wieck * - * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.33 2000/07/29 03:26:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.34 2000/08/01 18:29:35 tgl Exp $ * * ---------- */ @@ -1766,17 +1766,19 @@ numeric_float8(PG_FUNCTION_ARGS) { Numeric num = PG_GETARG_NUMERIC(0); char *tmp; - float64 result; + Datum result; if (NUMERIC_IS_NAN(num)) PG_RETURN_FLOAT8(NAN); tmp = DatumGetCString(DirectFunctionCall1(numeric_out, NumericGetDatum(num))); - result = float8in(tmp); + + result = DirectFunctionCall1(float8in, CStringGetDatum(tmp)); + pfree(tmp); - PG_RETURN_POINTER(result); + PG_RETURN_DATUM(result); } @@ -1809,17 +1811,19 @@ numeric_float4(PG_FUNCTION_ARGS) { Numeric num = PG_GETARG_NUMERIC(0); char *tmp; - float32 result; + Datum result; if (NUMERIC_IS_NAN(num)) - PG_RETURN_FLOAT4(NAN); + PG_RETURN_FLOAT4((float4) NAN); tmp = DatumGetCString(DirectFunctionCall1(numeric_out, NumericGetDatum(num))); - result = float4in(tmp); + + result = DirectFunctionCall1(float4in, CStringGetDatum(tmp)); + pfree(tmp); - PG_RETURN_POINTER(result); + PG_RETURN_DATUM(result); } |