@@ -30,43 +30,45 @@ Datum gbt_time_penalty(PG_FUNCTION_ARGS);
3030Datum gbt_time_same (PG_FUNCTION_ARGS );
3131
3232
33+ #define P_TimeADTGetDatum (x ) PointerGetDatum( &(x) )
34+
3335static bool
3436gbt_timegt (const void * a , const void * b )
3537{
3638 return DatumGetBool (
37- DirectFunctionCall2 (time_gt , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
39+ DirectFunctionCall2 (time_gt , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
3840 );
3941}
4042
4143static bool
4244gbt_timege (const void * a , const void * b )
4345{
4446 return DatumGetBool (
45- DirectFunctionCall2 (time_ge , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
47+ DirectFunctionCall2 (time_ge , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
4648 );
4749}
4850
4951static bool
5052gbt_timeeq (const void * a , const void * b )
5153{
5254 return DatumGetBool (
53- DirectFunctionCall2 (time_eq , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
55+ DirectFunctionCall2 (time_eq , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
5456 );
5557}
5658
5759static bool
5860gbt_timele (const void * a , const void * b )
5961{
6062 return DatumGetBool (
61- DirectFunctionCall2 (time_le , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
63+ DirectFunctionCall2 (time_le , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
6264 );
6365}
6466
6567static bool
6668gbt_timelt (const void * a , const void * b )
6769{
6870 return DatumGetBool (
69- DirectFunctionCall2 (time_lt , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
71+ DirectFunctionCall2 (time_lt , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
7072 );
7173}
7274
@@ -202,17 +204,17 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
202204
203205 intr = DatumGetIntervalP (DirectFunctionCall2 (
204206 time_mi_time ,
205- TimeADTGetDatum (newentry -> upper ),
206- TimeADTGetDatum (origentry -> upper )));
207+ P_TimeADTGetDatum (newentry -> upper ),
208+ P_TimeADTGetDatum (origentry -> upper )));
207209
208210 /* see interval_larger */
209211 res = Max (intr -> time + intr -> month * (30 * 86400 ), 0 );
210212 pfree (intr );
211213
212214 intr = DatumGetIntervalP (DirectFunctionCall2 (
213215 time_mi_time ,
214- TimeADTGetDatum (origentry -> lower ),
215- TimeADTGetDatum (newentry -> lower )));
216+ P_TimeADTGetDatum (origentry -> lower ),
217+ P_TimeADTGetDatum (newentry -> lower )));
216218
217219 /* see interval_larger */
218220 res += Max (intr -> time + intr -> month * (30 * 86400 ), 0 );
@@ -224,8 +226,8 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
224226 {
225227 intr = DatumGetIntervalP (DirectFunctionCall2 (
226228 time_mi_time ,
227- TimeADTGetDatum (origentry -> upper ),
228- TimeADTGetDatum (origentry -> lower )));
229+ P_TimeADTGetDatum (origentry -> upper ),
230+ P_TimeADTGetDatum (origentry -> lower )));
229231 * result += FLT_MIN ;
230232 * result += (float ) (res / ((double ) (res + intr -> time + intr -> month * (30 * 86400 ))));
231233 * result *= (FLT_MAX / (((GISTENTRY * ) PG_GETARG_POINTER (0 ))-> rel -> rd_att -> natts + 1 ));
0 commit comments