aboutsummaryrefslogtreecommitdiff
path: root/contrib/intarray/_int_gist.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-05-22 12:55:34 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-05-22 12:55:34 -0400
commitbe76af171cdb3e7465c4ef234af403f97ad79b7b (patch)
tree1fa62d2b7a6680a4237a1548f7002fa0b234b143 /contrib/intarray/_int_gist.c
parent66a4bad83aaa6613a45a00a488c04427f9969fb4 (diff)
downloadpostgresql-be76af171cdb3e7465c4ef234af403f97ad79b7b.tar.gz
postgresql-be76af171cdb3e7465c4ef234af403f97ad79b7b.zip
Initial pgindent run for v12.
This is still using the 2.0 version of pg_bsd_indent. I thought it would be good to commit this separately, so as to document the differences between 2.0 and 2.1 behavior. Discussion: https://postgr.es/m/16296.1558103386@sss.pgh.pa.us
Diffstat (limited to 'contrib/intarray/_int_gist.c')
-rw-r--r--contrib/intarray/_int_gist.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index fe10cb56b6e..13dd7ac202c 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -212,41 +212,44 @@ g_int_compress(PG_FUNCTION_ARGS)
*/
for (j = i = len - 1; i > 0 && lenr > 0; i--, j--)
{
- int r_end = dr[i];
- int r_start = r_end;
- while (i > 0 && lenr > 0 && dr[i-1] == r_start - 1)
+ int r_end = dr[i];
+ int r_start = r_end;
+
+ while (i > 0 && lenr > 0 && dr[i - 1] == r_start - 1)
--r_start, --i, --lenr;
- dr[2*j] = r_start;
- dr[2*j+1] = r_end;
+ dr[2 * j] = r_start;
+ dr[2 * j + 1] = r_end;
}
/* just copy the rest, if any, as trivial ranges */
for (; i >= 0; i--, j--)
- dr[2*j] = dr[2*j + 1] = dr[i];
+ dr[2 * j] = dr[2 * j + 1] = dr[i];
if (++j)
{
/*
* shunt everything down to start at the right place
*/
- memmove((void *) &dr[0], (void *) &dr[2*j], 2*(len - j) * sizeof(int32));
+ memmove((void *) &dr[0], (void *) &dr[2 * j], 2 * (len - j) * sizeof(int32));
}
+
/*
* make "len" be number of array elements, not ranges
*/
- len = 2*(len - j);
+ len = 2 * (len - j);
cand = 1;
while (len > MAXNUMRANGE * 2)
{
min = PG_INT64_MAX;
for (i = 2; i < len; i += 2)
- if (min > ((int64)dr[i] - (int64)dr[i - 1]))
+ if (min > ((int64) dr[i] - (int64) dr[i - 1]))
{
- min = ((int64)dr[i] - (int64)dr[i - 1]);
+ min = ((int64) dr[i] - (int64) dr[i - 1]);
cand = i;
}
memmove((void *) &dr[cand - 1], (void *) &dr[cand + 1], (len - cand - 1) * sizeof(int32));
len -= 2;
}
+
/*
* check sparseness of result
*/