@@ -30,43 +30,45 @@ Datum gbt_time_penalty(PG_FUNCTION_ARGS);
30
30
Datum gbt_time_same (PG_FUNCTION_ARGS );
31
31
32
32
33
+ #define P_TimeADTGetDatum (x ) PointerGetDatum( &(x) )
34
+
33
35
static bool
34
36
gbt_timegt (const void * a , const void * b )
35
37
{
36
38
return DatumGetBool (
37
- DirectFunctionCall2 (time_gt , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
39
+ DirectFunctionCall2 (time_gt , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
38
40
);
39
41
}
40
42
41
43
static bool
42
44
gbt_timege (const void * a , const void * b )
43
45
{
44
46
return DatumGetBool (
45
- DirectFunctionCall2 (time_ge , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
47
+ DirectFunctionCall2 (time_ge , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
46
48
);
47
49
}
48
50
49
51
static bool
50
52
gbt_timeeq (const void * a , const void * b )
51
53
{
52
54
return DatumGetBool (
53
- DirectFunctionCall2 (time_eq , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
55
+ DirectFunctionCall2 (time_eq , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
54
56
);
55
57
}
56
58
57
59
static bool
58
60
gbt_timele (const void * a , const void * b )
59
61
{
60
62
return DatumGetBool (
61
- DirectFunctionCall2 (time_le , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
63
+ DirectFunctionCall2 (time_le , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
62
64
);
63
65
}
64
66
65
67
static bool
66
68
gbt_timelt (const void * a , const void * b )
67
69
{
68
70
return DatumGetBool (
69
- DirectFunctionCall2 (time_lt , TimeADTGetDatum (* ((TimeADT * ) a )), TimeADTGetDatum (* ((TimeADT * ) b )))
71
+ DirectFunctionCall2 (time_lt , P_TimeADTGetDatum (* ((TimeADT * ) a )), P_TimeADTGetDatum (* ((TimeADT * ) b )))
70
72
);
71
73
}
72
74
@@ -202,17 +204,17 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
202
204
203
205
intr = DatumGetIntervalP (DirectFunctionCall2 (
204
206
time_mi_time ,
205
- TimeADTGetDatum (newentry -> upper ),
206
- TimeADTGetDatum (origentry -> upper )));
207
+ P_TimeADTGetDatum (newentry -> upper ),
208
+ P_TimeADTGetDatum (origentry -> upper )));
207
209
208
210
/* see interval_larger */
209
211
res = Max (intr -> time + intr -> month * (30 * 86400 ), 0 );
210
212
pfree (intr );
211
213
212
214
intr = DatumGetIntervalP (DirectFunctionCall2 (
213
215
time_mi_time ,
214
- TimeADTGetDatum (origentry -> lower ),
215
- TimeADTGetDatum (newentry -> lower )));
216
+ P_TimeADTGetDatum (origentry -> lower ),
217
+ P_TimeADTGetDatum (newentry -> lower )));
216
218
217
219
/* see interval_larger */
218
220
res += Max (intr -> time + intr -> month * (30 * 86400 ), 0 );
@@ -224,8 +226,8 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
224
226
{
225
227
intr = DatumGetIntervalP (DirectFunctionCall2 (
226
228
time_mi_time ,
227
- TimeADTGetDatum (origentry -> upper ),
228
- TimeADTGetDatum (origentry -> lower )));
229
+ P_TimeADTGetDatum (origentry -> upper ),
230
+ P_TimeADTGetDatum (origentry -> lower )));
229
231
* result += FLT_MIN ;
230
232
* result += (float ) (res / ((double ) (res + intr -> time + intr -> month * (30 * 86400 ))));
231
233
* result *= (FLT_MAX / (((GISTENTRY * ) PG_GETARG_POINTER (0 ))-> rel -> rd_att -> natts + 1 ));
0 commit comments