@@ -26,15 +26,15 @@ typedef struct
26
26
#define GIDX_MAX_SIZE 36
27
27
#define GIDX_MAX_DIM 4
28
28
29
-
30
29
/*
31
30
* This macro is based on PG_FREE_IF_COPY, except that it accepts two pointers.
32
31
* See PG_FREE_IF_COPY comment in src/include/fmgr.h in postgres source code
33
32
* for more details.
34
33
*/
35
34
#define POSTGIS_FREE_IF_COPY_P (ptrsrc , ptrori ) \
36
- do { \
37
- if ((Pointer) (ptrsrc) != (Pointer) (ptrori)) \
35
+ do \
36
+ { \
37
+ if ((Pointer)(ptrsrc) != (Pointer)(ptrori)) \
38
38
pfree(ptrsrc); \
39
39
} while (0)
40
40
@@ -51,7 +51,6 @@ typedef struct
51
51
float xmin , xmax , ymin , ymax ;
52
52
} BOX2DF ;
53
53
54
-
55
54
/*********************************************************************************
56
55
** GIDX support functions.
57
56
**
@@ -61,7 +60,7 @@ typedef struct
61
60
*/
62
61
63
62
/* allocate a new gidx object on the heap */
64
- GIDX * gidx_new (int ndims ) ;
63
+ GIDX * gidx_new (int ndims );
65
64
66
65
/* Increase the size of a GIDX */
67
66
void gidx_expand (GIDX * a , float d );
@@ -70,7 +69,7 @@ void gidx_expand(GIDX *a, float d);
70
69
bool gidx_is_unknown (const GIDX * a );
71
70
72
71
/* Generate human readable form for GIDX. */
73
- char * gidx_to_string (GIDX * a ) ;
72
+ char * gidx_to_string (GIDX * a );
74
73
75
74
/* typedef to correct array-bounds checking for casts to GIDX - do not
76
75
use this ANYWHERE except in the casts below */
@@ -79,24 +78,24 @@ typedef float _gidx_float_array[sizeof(float) * 2 * 4];
79
78
/* Returns number of dimensions for this GIDX */
80
79
#define GIDX_NDIMS (gidx ) ((VARSIZE((gidx)) - VARHDRSZ) / (2 * sizeof(float)))
81
80
/* Minimum accessor. */
82
- #define GIDX_GET_MIN (gidx , dimension ) (*((_gidx_float_array *)(&(gidx)->c)))[2* (dimension)]
81
+ #define GIDX_GET_MIN (gidx , dimension ) (*((_gidx_float_array *)(&(gidx)->c)))[2 * (dimension)]
83
82
/* Maximum accessor. */
84
- #define GIDX_GET_MAX (gidx , dimension ) (*((_gidx_float_array *)(&(gidx)->c)))[2* (dimension)+ 1]
83
+ #define GIDX_GET_MAX (gidx , dimension ) (*((_gidx_float_array *)(&(gidx)->c)))[2 * (dimension) + 1]
85
84
/* Minimum setter. */
86
- #define GIDX_SET_MIN (gidx , dimension , value ) ((gidx)->c[2* (dimension)] = (value))
85
+ #define GIDX_SET_MIN (gidx , dimension , value ) ((gidx)->c[2 * (dimension)] = (value))
87
86
/* Maximum setter. */
88
- #define GIDX_SET_MAX (gidx , dimension , value ) ((gidx)->c[2* (dimension)+ 1] = (value))
87
+ #define GIDX_SET_MAX (gidx , dimension , value ) ((gidx)->c[2 * (dimension) + 1] = (value))
89
88
/* Returns the size required to store a GIDX of requested dimension */
90
- #define GIDX_SIZE (dimensions ) (sizeof(int32) + 2* (dimensions)* sizeof(float))
89
+ #define GIDX_SIZE (dimensions ) (sizeof(int32) + 2 * (dimensions) * sizeof(float))
91
90
92
91
/* Allocate a copy of the box */
93
- BOX2DF * box2df_copy (BOX2DF * b );
92
+ BOX2DF * box2df_copy (BOX2DF * b );
94
93
95
94
/* Grow the first argument to contain the second */
96
95
void box2df_merge (BOX2DF * b_union , BOX2DF * b_new );
97
96
98
97
/* Allocate a copy of the box */
99
- GIDX * gidx_copy (GIDX * b );
98
+ GIDX * gidx_copy (GIDX * b );
100
99
101
100
/* Grow the first argument to contain the second */
102
101
void gidx_merge (GIDX * * b_union , GIDX * b_new );
@@ -122,16 +121,14 @@ int gserialized_datum_get_gidx_p(Datum gserialized_datum, GIDX *gidx);
122
121
/* Pull out the gidx bounding box from an already de-toasted geography */
123
122
int gserialized_get_gidx_p (const GSERIALIZED * g , GIDX * gidx );
124
123
/* Copy a new bounding box into an existing gserialized */
125
- GSERIALIZED * gserialized_set_gidx (GSERIALIZED * g , GIDX * gidx );
124
+ GSERIALIZED * gserialized_set_gidx (GSERIALIZED * g , GIDX * gidx );
126
125
127
126
/* Given two datums, do they overlap? Computed very fast using embedded boxes. */
128
127
/* int gserialized_datum_overlaps(Datum gs1, Datum gs2); */
129
128
/* Remove the box from a disk serialization */
130
- GSERIALIZED * gserialized_drop_gidx (GSERIALIZED * g );
129
+ GSERIALIZED * gserialized_drop_gidx (GSERIALIZED * g );
131
130
132
131
bool box2df_contains (const BOX2DF * a , const BOX2DF * b );
133
-
134
-
135
132
void box2df_set_empty (BOX2DF * a );
136
133
void box2df_set_finite (BOX2DF * a );
137
134
void box2df_validate (BOX2DF * b );
@@ -146,7 +143,9 @@ bool box2df_below(const BOX2DF *a, const BOX2DF *b);
146
143
bool box2df_above (const BOX2DF * a , const BOX2DF * b );
147
144
bool box2df_overabove (const BOX2DF * a , const BOX2DF * b );
148
145
149
-
146
+ void gidx_validate (GIDX * b );
147
+ void gidx_set_unknown (GIDX * a );
148
+ bool gidx_overlaps (GIDX * a , GIDX * b );
149
+ bool gidx_equals (GIDX * a , GIDX * b );
150
150
bool gidx_contains (GIDX * a , GIDX * b );
151
151
int gserialized_datum_get_box2df_p (Datum gsdatum , BOX2DF * box2df );
152
-
0 commit comments