Skip to content

Commit fed4c82

Browse files
committed
formatting for gist files
1 parent 516f4b2 commit fed4c82

File tree

2 files changed

+79
-61
lines changed

2 files changed

+79
-61
lines changed

gist.c

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,14 @@ g_spherekey_union(PG_FUNCTION_ARGS)
277277
int32 *ret = (int32 *) palloc(KEYSIZE);
278278

279279
numranges = entryvec->n;
280-
memcpy((void *) ret, (void *) DatumGetPointer(entryvec->vector[0].key), KEYSIZE);
280+
memcpy((void *) ret,
281+
(void *) DatumGetPointer(entryvec->vector[0].key),
282+
KEYSIZE);
281283

282284
for (i = 1; i < numranges; i++)
283285
{
284-
spherekey_union_two(ret, (int32 *) DatumGetPointer(entryvec->vector[i].key));
286+
spherekey_union_two(ret,
287+
(int32 *) DatumGetPointer(entryvec->vector[i].key));
285288
}
286289
*sizep = KEYSIZE;
287290
PG_RETURN_POINTER(ret);
@@ -1285,9 +1288,14 @@ sizeBox3D(Box3D *b)
12851288
static inline double
12861289
unionSizeBox3D(Box3D *a, Box3D *b)
12871290
{
1288-
return (double) ((int64) Max(a->high.coord[0], b->high.coord[0]) - (int64) Min(a->low.coord[0], b->low.coord[0])) / MAXCVALUE
1289-
* (double) ((int64) Max(a->high.coord[1], b->high.coord[1]) - (int64) Min(a->low.coord[1], b->low.coord[1])) / MAXCVALUE
1290-
* (double) ((int64) Max(a->high.coord[2], b->high.coord[2]) - (int64) Min(a->low.coord[2], b->low.coord[2])) / MAXCVALUE;
1291+
return (double) ((int64) Max(a->high.coord[0], b->high.coord[0]) -
1292+
(int64) Min(a->low.coord[0], b->low.coord[0])) / MAXCVALUE
1293+
1294+
* (double) ((int64) Max(a->high.coord[1], b->high.coord[1]) -
1295+
(int64) Min(a->low.coord[1], b->low.coord[1])) / MAXCVALUE
1296+
1297+
* (double) ((int64) Max(a->high.coord[2], b->high.coord[2]) -
1298+
(int64) Min(a->low.coord[2], b->low.coord[2])) / MAXCVALUE;
12911299
}
12921300

12931301
/*
@@ -1297,10 +1305,10 @@ unionSizeBox3D(Box3D *a, Box3D *b)
12971305
static void
12981306
fallbackSplit(Box3D *boxes, OffsetNumber maxoff, GIST_SPLITVEC *v)
12991307
{
1300-
OffsetNumber i;
1301-
Box3D *unionL = NULL,
1302-
*unionR = NULL;
1303-
int nbytes;
1308+
OffsetNumber i;
1309+
Box3D *unionL = NULL,
1310+
*unionR = NULL;
1311+
int nbytes;
13041312

13051313
nbytes = (maxoff + 2) * sizeof(OffsetNumber);
13061314
v->spl_left = (OffsetNumber *) palloc(nbytes);
@@ -1309,7 +1317,7 @@ fallbackSplit(Box3D *boxes, OffsetNumber maxoff, GIST_SPLITVEC *v)
13091317

13101318
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
13111319
{
1312-
Box3D *cur = &boxes[i];
1320+
Box3D *cur = &boxes[i];
13131321

13141322
if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
13151323
{
@@ -1888,7 +1896,10 @@ do_picksplit(Box3D *boxes, OffsetNumber maxoff, GIST_SPLITVEC *v)
18881896
* Sort "common entries" by calculated deltas in order to distribute
18891897
* the most ambiguous entries first.
18901898
*/
1891-
qsort(commonEntries, commonEntriesCount, sizeof(CommonEntry), common_entry_cmp);
1899+
qsort(commonEntries,
1900+
commonEntriesCount,
1901+
sizeof(CommonEntry),
1902+
common_entry_cmp);
18921903

18931904
/*
18941905
* Distribute "common entries" between groups.
@@ -1914,7 +1925,8 @@ do_picksplit(Box3D *boxes, OffsetNumber maxoff, GIST_SPLITVEC *v)
19141925
else
19151926
{
19161927
/* Otherwise select the group by minimal penalty */
1917-
if (unionSizeBox3D(leftBox, box) - leftBoxSize < unionSizeBox3D(rightBox, box) - rightBoxSize)
1928+
if (unionSizeBox3D(leftBox, box) - leftBoxSize <
1929+
unionSizeBox3D(rightBox, box) - rightBoxSize)
19181930
{
19191931
PLACE_LEFT(box, commonEntries[i].index);
19201932
/* checkBox3D(leftBox); */
@@ -1971,12 +1983,18 @@ g_spherekey_penalty(PG_FUNCTION_ARGS)
19711983
{
19721984
Box3D *n = (Box3D *) DatumGetPointer(newentry->key);
19731985

1974-
*result = (float) (((uint64) (Max(o->high.coord[0], n->high.coord[0]) - Min(o->low.coord[0], n->low.coord[0])) >> 10)
1975-
* ((uint64) (Max(o->high.coord[1], n->high.coord[1]) - Min(o->low.coord[1], n->low.coord[1])) >> 10)
1976-
* ((uint64) (Max(o->high.coord[2], n->high.coord[2]) - Min(o->low.coord[2], n->low.coord[2])) >> 10)
1977-
- ((uint64) (o->high.coord[0] - o->low.coord[0]) >> 10)
1978-
* ((uint64) (o->high.coord[1] - o->low.coord[1]) >> 10)
1979-
* ((uint64) (o->high.coord[2] - o->low.coord[2]) >> 10));
1986+
*result = (float) (((uint64) (Max(o->high.coord[0], n->high.coord[0]) -
1987+
Min(o->low.coord[0], n->low.coord[0])) >> 10)
1988+
1989+
* ((uint64) (Max(o->high.coord[1], n->high.coord[1]) -
1990+
Min(o->low.coord[1], n->low.coord[1])) >> 10)
1991+
1992+
* ((uint64) (Max(o->high.coord[2], n->high.coord[2]) -
1993+
Min(o->low.coord[2], n->low.coord[2])) >> 10)
1994+
1995+
- ((uint64) (o->high.coord[0] - o->low.coord[0]) >> 10)
1996+
* ((uint64) (o->high.coord[1] - o->low.coord[1]) >> 10)
1997+
* ((uint64) (o->high.coord[2] - o->low.coord[2]) >> 10));
19801998
PG_RETURN_POINTER(result);
19811999
}
19822000
else

gist.h

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,137 +16,137 @@ typedef unsigned char uchar;
1616
#define SCKEY_IN 2 /* first key contains second key */
1717
#define SCKEY_SAME 3 /* keys are equal */
1818

19-
uchar spherekey_interleave(const int32 *k1, const int32 *k2);
19+
uchar spherekey_interleave(const int32 *k1, const int32 *k2);
2020

2121
/*
2222
* For given "query" of "pgstype" of PGS_DATA_TYPES type, puts key of cached
2323
* query into "key" pointer. Returns true when given query is equal to
2424
* current query.
2525
*/
26-
bool gq_cache_get_value(unsigned pgstype, const void *query, int32 **key);
26+
bool gq_cache_get_value(unsigned pgstype, const void *query, int32 **key);
2727

2828
/*
2929
* Copy current query, type and its key value to cache.
3030
*/
31-
void gq_cache_set_value(unsigned pgstype, const void *query, const int32 *key);
31+
void gq_cache_set_value(unsigned pgstype, const void *query, const int32 *key);
3232

3333
/*
3434
* Input function of key value. Just a dummy. But PostgreSQL need this
3535
* function to create a data type.
3636
*/
37-
Datum spherekey_in(PG_FUNCTION_ARGS);
37+
Datum spherekey_in(PG_FUNCTION_ARGS);
3838

3939
/*
4040
* Output function of key value. Just a dummy. But PostgreSQL need this
4141
* function to create a data type.
4242
*/
43-
Datum spherekey_out(PG_FUNCTION_ARGS);
43+
Datum spherekey_out(PG_FUNCTION_ARGS);
4444

4545
/*
4646
* GIST's decompress method. This function does nothing.
4747
*/
48-
Datum g_spherekey_decompress(PG_FUNCTION_ARGS);
48+
Datum g_spherekey_decompress(PG_FUNCTION_ARGS);
4949

5050
/*
51-
* GIST's compress method for circle. Creates the key value from spherical
51+
* GIST's compress method for circle. Creates the key value from a spherical
5252
* circle.
5353
*/
54-
Datum g_scircle_compress(PG_FUNCTION_ARGS);
54+
Datum g_scircle_compress(PG_FUNCTION_ARGS);
5555

5656
/*
57-
* GIST's compress method for point. Creates the key value from spherical point.
57+
* GIST's compress method for point. Creates the key value from a spherical point.
5858
*/
59-
Datum g_spoint_compress(PG_FUNCTION_ARGS);
59+
Datum g_spoint_compress(PG_FUNCTION_ARGS);
6060

6161
/*
62-
* GIST's compress method for line. Creates the key value from spherical line.
62+
* GIST's compress method for line. Creates the key value from a spherical line.
6363
*/
64-
Datum g_sline_compress(PG_FUNCTION_ARGS);
64+
Datum g_sline_compress(PG_FUNCTION_ARGS);
6565

6666
/*
67-
* GIST's compress method for path. Creates the key value from spherical path.
67+
* GIST's compress method for path. Creates the key value from a spherical path.
6868
*/
69-
Datum g_spath_compress(PG_FUNCTION_ARGS);
69+
Datum g_spath_compress(PG_FUNCTION_ARGS);
7070

7171
/*
72-
* GIST's compress method for polygon. Creates the key value from spherical
72+
* GIST's compress method for polygon. Creates the key value from a spherical
7373
* polygon.
7474
*/
75-
Datum g_spoly_compress(PG_FUNCTION_ARGS);
75+
Datum g_spoly_compress(PG_FUNCTION_ARGS);
7676

7777
/*
78-
* GIST's compress method for ellipse. Creates the key value from spherical
78+
* GIST's compress method for ellipse. Creates the key value from a spherical
7979
* ellipse.
8080
*/
81-
Datum g_sellipse_compress(PG_FUNCTION_ARGS);
81+
Datum g_sellipse_compress(PG_FUNCTION_ARGS);
8282

8383
/*
84-
* GIST's compress method for box. Creates the key value from spherical box.
84+
* GIST's compress method for box. Creates the key value from a spherical box.
8585
*/
86-
Datum g_sbox_compress(PG_FUNCTION_ARGS);
86+
Datum g_sbox_compress(PG_FUNCTION_ARGS);
8787

8888
/*
8989
* The GiST Union method for boxes. Returns the minimal bounding box that
9090
* encloses all the entries in entryvec.
9191
*/
92-
Datum g_spherekey_union(PG_FUNCTION_ARGS);
92+
Datum g_spherekey_union(PG_FUNCTION_ARGS);
9393

9494
/*
9595
* GIST's equality method.
9696
*/
97-
Datum g_spherekey_same(PG_FUNCTION_ARGS);
97+
Datum g_spherekey_same(PG_FUNCTION_ARGS);
9898

9999
/*
100-
* GIST's consistent method for point.
100+
* GIST's consistent method for a point.
101101
*/
102-
Datum g_spoint_consistent(PG_FUNCTION_ARGS);
102+
Datum g_spoint_consistent(PG_FUNCTION_ARGS);
103103

104104
/*
105-
* GIST's consistent method for circle.
105+
* GIST's consistent method for a circle.
106106
*/
107-
Datum g_scircle_consistent(PG_FUNCTION_ARGS);
107+
Datum g_scircle_consistent(PG_FUNCTION_ARGS);
108108

109109
/*
110-
* GIST's consistent method for line.
110+
* GIST's consistent method for a line.
111111
*/
112-
Datum g_sline_consistent(PG_FUNCTION_ARGS);
112+
Datum g_sline_consistent(PG_FUNCTION_ARGS);
113113

114114
/*
115-
* GIST's consistent method for path.
115+
* GIST's consistent method for a path.
116116
*/
117-
Datum g_spath_consistent(PG_FUNCTION_ARGS);
117+
Datum g_spath_consistent(PG_FUNCTION_ARGS);
118118

119119
/*
120-
* GIST's consistent method for polygon.
120+
* GIST's consistent method for a polygon.
121121
*/
122-
Datum g_spoly_consistent(PG_FUNCTION_ARGS);
122+
Datum g_spoly_consistent(PG_FUNCTION_ARGS);
123123

124124
/*
125-
* GIST's consistent method for ellipse.
125+
* GIST's consistent method for an ellipse.
126126
*/
127-
Datum g_sellipse_consistent(PG_FUNCTION_ARGS);
127+
Datum g_sellipse_consistent(PG_FUNCTION_ARGS);
128128

129129
/*
130-
* GIST's consistent method for box.
130+
* GIST's consistent method for a box.
131131
*/
132-
Datum g_sbox_consistent(PG_FUNCTION_ARGS);
132+
Datum g_sbox_consistent(PG_FUNCTION_ARGS);
133133

134134
/*
135135
* GIST's penalty method.
136136
*/
137-
Datum g_spherekey_penalty(PG_FUNCTION_ARGS);
137+
Datum g_spherekey_penalty(PG_FUNCTION_ARGS);
138138

139139
/*
140140
* GIST's picksplit method. This method is using the double sorting node
141141
* splitting algorithm for R-Trees. See "A new double sorting-based node
142142
* splitting algorithm for R-tree", A. Korotkov.
143143
*/
144-
Datum g_spherekey_picksplit(PG_FUNCTION_ARGS);
144+
Datum g_spherekey_picksplit(PG_FUNCTION_ARGS);
145145

146-
Datum pointkey_in(PG_FUNCTION_ARGS);
147-
Datum pointkey_out(PG_FUNCTION_ARGS);
148-
Datum pointkey_volume(PG_FUNCTION_ARGS);
149-
Datum pointkey_area(PG_FUNCTION_ARGS);
150-
Datum pointkey_perimeter(PG_FUNCTION_ARGS);
146+
Datum pointkey_in(PG_FUNCTION_ARGS);
147+
Datum pointkey_out(PG_FUNCTION_ARGS);
148+
Datum pointkey_volume(PG_FUNCTION_ARGS);
149+
Datum pointkey_area(PG_FUNCTION_ARGS);
150+
Datum pointkey_perimeter(PG_FUNCTION_ARGS);
151151

152152
#endif

0 commit comments

Comments
 (0)