diff options
author | Neil Conway <neilc@samurai.com> | 2005-05-21 12:08:06 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2005-05-21 12:08:06 +0000 |
commit | 36ab6005119532903d4ce3ad564e6576bd7698b8 (patch) | |
tree | fb6f1c25a78b5fe285a7496c4893565b76c5893f /contrib/btree_gist/btree_numeric.c | |
parent | 875813439d0659a2adacc54409793a793f959ea7 (diff) | |
download | postgresql-36ab6005119532903d4ce3ad564e6576bd7698b8.tar.gz postgresql-36ab6005119532903d4ce3ad564e6576bd7698b8.zip |
Cleanup of GiST extensions in contrib/: now that we always invoke GiST
methods in a short-lived memory context, there is no need for GiST methods
to do their own manual (and error-prone) memory management.
Diffstat (limited to 'contrib/btree_gist/btree_numeric.c')
-rw-r--r-- | contrib/btree_gist/btree_numeric.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/contrib/btree_gist/btree_numeric.c b/contrib/btree_gist/btree_numeric.c index d9c3184fe6d..fcfd4613ef1 100644 --- a/contrib/btree_gist/btree_numeric.c +++ b/contrib/btree_gist/btree_numeric.c @@ -98,16 +98,12 @@ gbt_numeric_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key); - void *qtst = (void *) PG_GETARG_POINTER(1); void *query = (void *) DatumGetNumeric(PG_GETARG_DATUM(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); - bool retval = FALSE; + bool retval; GBT_VARKEY_R r = gbt_var_key_readable(key); retval = gbt_var_consistent(&r, query, &strategy, GIST_LEAF(entry), &tinfo); - - if (qtst != query) - pfree(query); PG_RETURN_BOOL(retval); } @@ -164,8 +160,6 @@ gbt_numeric_penalty(PG_FUNCTION_ARGS) PointerGetDatum(uk.lower) )); - pfree(DatumGetPointer(uni)); - os = DatumGetNumeric(DirectFunctionCall2( numeric_sub, PointerGetDatum(ok.upper), @@ -178,27 +172,21 @@ gbt_numeric_penalty(PG_FUNCTION_ARGS) NumericGetDatum(os) )); - pfree(os); - if (NUMERIC_IS_NAN(us)) { - if (NUMERIC_IS_NAN(os)) *result = 0.0; else *result = 1.0; - } else { - Numeric nul = DatumGetNumeric(DirectFunctionCall1(int4_numeric, Int32GetDatum(0))); *result = 0.0; if (DirectFunctionCall2(numeric_gt, NumericGetDatum(ds), NumericGetDatum(nul))) { - *result += FLT_MIN; os = DatumGetNumeric(DirectFunctionCall2( numeric_div, @@ -206,19 +194,12 @@ gbt_numeric_penalty(PG_FUNCTION_ARGS) NumericGetDatum(us) )); *result += (float4) DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow, NumericGetDatum(os))); - pfree(os); - } - - pfree(nul); } if (*result > 0) *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1)); - pfree(us); - pfree(ds); - PG_RETURN_POINTER(result); } |