Skip to content

Commit 2d97f16

Browse files
committed
Refactor and bug fix.
1 parent ca6cfa8 commit 2d97f16

File tree

10 files changed

+188
-175
lines changed

10 files changed

+188
-175
lines changed

box.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
172172
((sc->center.lat + sc->radius) <= sb->ne.lat) &&
173173
((sc->center.lat - sc->radius) >= sb->sw.lat);
174174
bool bcc = sbox_cont_point(sb, &sc->center);
175-
bool ccb = FALSE;
175+
bool ccb = false;
176176
int8 pw,
177177
pe;
178178
SLine bw,
@@ -218,8 +218,8 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
218218
}
219219
if (bcc && lat_b_cont_c)
220220
{
221-
bool touw = FALSE,
222-
toue = FALSE;
221+
bool touw = false,
222+
toue = false;
223223

224224
if (pw == PGS_CIRCLE_LINE_OVER)
225225
{
@@ -804,7 +804,7 @@ sbox_box_pos(const SBOX *b1, const SBOX *b2, bool recheck)
804804

805805
if (!recheck)
806806
{
807-
pe = sbox_box_pos(b2, b1, TRUE);
807+
pe = sbox_box_pos(b2, b1, true);
808808
if (pe == PGS_BOX_CONT)
809809
{
810810
return PGS_BOX_OVER;
@@ -1503,7 +1503,7 @@ spherebox_cont_box(PG_FUNCTION_ARGS)
15031503
SBOX *box1 = (SBOX *) PG_GETARG_POINTER(0);
15041504
SBOX *box2 = (SBOX *) PG_GETARG_POINTER(1);
15051505

1506-
PG_RETURN_BOOL(sbox_box_pos(box1, box2, FALSE) == PGS_BOX_CONT);
1506+
PG_RETURN_BOOL(sbox_box_pos(box1, box2, false) == PGS_BOX_CONT);
15071507
}
15081508

15091509
Datum
@@ -1512,7 +1512,7 @@ spherebox_cont_box_neg(PG_FUNCTION_ARGS)
15121512
SBOX *box1 = (SBOX *) PG_GETARG_POINTER(0);
15131513
SBOX *box2 = (SBOX *) PG_GETARG_POINTER(1);
15141514

1515-
PG_RETURN_BOOL(!(sbox_box_pos(box1, box2, FALSE) == PGS_BOX_CONT));
1515+
PG_RETURN_BOOL(!(sbox_box_pos(box1, box2, false) == PGS_BOX_CONT));
15161516
}
15171517

15181518
Datum
@@ -1521,7 +1521,7 @@ spherebox_cont_box_com(PG_FUNCTION_ARGS)
15211521
SBOX *box1 = (SBOX *) PG_GETARG_POINTER(1);
15221522
SBOX *box2 = (SBOX *) PG_GETARG_POINTER(0);
15231523

1524-
PG_RETURN_BOOL(sbox_box_pos(box1, box2, FALSE) == PGS_BOX_CONT);
1524+
PG_RETURN_BOOL(sbox_box_pos(box1, box2, false) == PGS_BOX_CONT);
15251525
}
15261526

15271527
Datum
@@ -1530,7 +1530,7 @@ spherebox_cont_box_com_neg(PG_FUNCTION_ARGS)
15301530
SBOX *box1 = (SBOX *) PG_GETARG_POINTER(1);
15311531
SBOX *box2 = (SBOX *) PG_GETARG_POINTER(0);
15321532

1533-
PG_RETURN_BOOL(!(sbox_box_pos(box1, box2, FALSE) == PGS_BOX_CONT));
1533+
PG_RETURN_BOOL(!(sbox_box_pos(box1, box2, false) == PGS_BOX_CONT));
15341534
}
15351535

15361536
Datum
@@ -1539,7 +1539,7 @@ spherebox_overlap_box(PG_FUNCTION_ARGS)
15391539
SBOX *box1 = (SBOX *) PG_GETARG_POINTER(0);
15401540
SBOX *box2 = (SBOX *) PG_GETARG_POINTER(1);
15411541

1542-
PG_RETURN_BOOL(sbox_box_pos(box1, box2, FALSE) > PGS_BOX_AVOID);
1542+
PG_RETURN_BOOL(sbox_box_pos(box1, box2, false) > PGS_BOX_AVOID);
15431543
}
15441544

15451545
Datum
@@ -1548,5 +1548,5 @@ spherebox_overlap_box_neg(PG_FUNCTION_ARGS)
15481548
SBOX *box1 = (SBOX *) PG_GETARG_POINTER(0);
15491549
SBOX *box2 = (SBOX *) PG_GETARG_POINTER(1);
15501550

1551-
PG_RETURN_BOOL(sbox_box_pos(box1, box2, FALSE) == PGS_BOX_AVOID);
1551+
PG_RETURN_BOOL(sbox_box_pos(box1, box2, false) == PGS_BOX_AVOID);
15521552
}

circle.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ spherecircle_in_circle(PG_FUNCTION_ARGS)
208208

209209
if (scircle_eq(c1, c2))
210210
{
211-
PG_RETURN_BOOL(TRUE);
211+
PG_RETURN_BOOL(true);
212212
}
213213
else if (FPle((dist + c1->radius), c2->radius))
214214
{
215-
PG_RETURN_BOOL(TRUE);
215+
PG_RETURN_BOOL(true);
216216
}
217217
else
218218
{
219-
PG_RETURN_BOOL(FALSE);
219+
PG_RETURN_BOOL(false);
220220
}
221221
}
222222

@@ -229,15 +229,15 @@ spherecircle_in_circle_neg(PG_FUNCTION_ARGS)
229229

230230
if (scircle_eq(c1, c2))
231231
{
232-
PG_RETURN_BOOL(FALSE);
232+
PG_RETURN_BOOL(false);
233233
}
234234
else if (FPgt((dist + c1->radius), c2->radius))
235235
{
236-
PG_RETURN_BOOL(TRUE);
236+
PG_RETURN_BOOL(true);
237237
}
238238
else
239239
{
240-
PG_RETURN_BOOL(FALSE);
240+
PG_RETURN_BOOL(false);
241241
}
242242
}
243243

@@ -250,15 +250,15 @@ spherecircle_in_circle_com(PG_FUNCTION_ARGS)
250250

251251
if (scircle_eq(c1, c2))
252252
{
253-
PG_RETURN_BOOL(TRUE);
253+
PG_RETURN_BOOL(true);
254254
}
255255
else if (FPle((dist + c1->radius), c2->radius))
256256
{
257-
PG_RETURN_BOOL(TRUE);
257+
PG_RETURN_BOOL(true);
258258
}
259259
else
260260
{
261-
PG_RETURN_BOOL(FALSE);
261+
PG_RETURN_BOOL(false);
262262
}
263263
}
264264

@@ -271,15 +271,15 @@ spherecircle_in_circle_com_neg(PG_FUNCTION_ARGS)
271271

272272
if (scircle_eq(c1, c2))
273273
{
274-
PG_RETURN_BOOL(FALSE);
274+
PG_RETURN_BOOL(false);
275275
}
276276
else if (FPgt((dist + c1->radius), c2->radius))
277277
{
278-
PG_RETURN_BOOL(TRUE);
278+
PG_RETURN_BOOL(true);
279279
}
280280
else
281281
{
282-
PG_RETURN_BOOL(FALSE);
282+
PG_RETURN_BOOL(false);
283283
}
284284
}
285285

@@ -292,15 +292,15 @@ spherecircle_overlap(PG_FUNCTION_ARGS)
292292

293293
if (scircle_eq(c1, c2))
294294
{
295-
PG_RETURN_BOOL(TRUE);
295+
PG_RETURN_BOOL(true);
296296
}
297297
else if (FPlt((c1->radius + c2->radius), dist))
298298
{
299-
PG_RETURN_BOOL(FALSE);
299+
PG_RETURN_BOOL(false);
300300
}
301301
else
302302
{
303-
PG_RETURN_BOOL(TRUE);
303+
PG_RETURN_BOOL(true);
304304
}
305305
}
306306

@@ -313,15 +313,15 @@ spherecircle_overlap_neg(PG_FUNCTION_ARGS)
313313

314314
if (scircle_eq(c1, c2))
315315
{
316-
PG_RETURN_BOOL(FALSE);
316+
PG_RETURN_BOOL(false);
317317
}
318318
else if (FPge((c1->radius + c2->radius), dist))
319319
{
320-
PG_RETURN_BOOL(FALSE);
320+
PG_RETURN_BOOL(false);
321321
}
322322
else
323323
{
324-
PG_RETURN_BOOL(TRUE);
324+
PG_RETURN_BOOL(true);
325325
}
326326
}
327327

crossmatch.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
#include "utils/lsyscache.h"
4141
#include "utils/rel.h"
4242

43+
#if PG_VERSION_NUM >= 90600
44+
#define heap_formtuple heap_form_tuple
45+
#endif
46+
4347
/*
4448
* Pair of pages for pending scan.
4549
*/

ellipse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,11 +617,11 @@ sellipse_cont_point(const SELLIPSE *se, const SPoint *sp)
617617
a = sellipse_dist(se->rad[0], se->rad[1], e);
618618
if (FPge(a, dist))
619619
{
620-
return TRUE;
620+
return true;
621621
}
622622
else
623623
{
624-
return FALSE;
624+
return false;
625625
}
626626
}
627627
return false;

0 commit comments

Comments
 (0)