summaryrefslogtreecommitdiff
path: root/src/backend/statistics
diff options
context:
space:
mode:
authorTom Lane2017-06-21 18:39:04 +0000
committerTom Lane2017-06-21 18:39:04 +0000
commite3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 (patch)
tree8dc7df95c340803546152724fbc17aee4b8527f9 /src/backend/statistics
parent8ff6d4ec7840b0af56f1207073f44b7f2afae96d (diff)
Initial pgindent run with pg_bsd_indent version 2.0.
The new indent version includes numerous fixes thanks to Piotr Stefaniak. The main changes visible in this commit are: * Nicer formatting of function-pointer declarations. * No longer unexpectedly removes spaces in expressions using casts, sizeof, or offsetof. * No longer wants to add a space in "struct structname *varname", as well as some similar cases for const- or volatile-qualified pointers. * Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely. * Fixes bug where comments following declarations were sometimes placed with no space separating them from the code. * Fixes some odd decisions for comments following case labels. * Fixes some cases where comments following code were indented to less than the expected column 33. On the less good side, it now tends to put more whitespace around typedef names that are not listed in typedefs.list. This might encourage us to put more effort into typedef name collection; it's not really a bug in indent itself. There are more changes coming after this round, having to do with comment indentation and alignment of lines appearing within parentheses. I wanted to limit the size of the diffs to something that could be reviewed without one's eyes completely glazing over, so it seemed better to split up the changes as much as practical. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
Diffstat (limited to 'src/backend/statistics')
-rw-r--r--src/backend/statistics/dependencies.c8
-rw-r--r--src/backend/statistics/extended_stats.c2
-rw-r--r--src/backend/statistics/mvdistinct.c6
3 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c
index ba3b1d00bb1..00ee3a3e0a3 100644
--- a/src/backend/statistics/dependencies.c
+++ b/src/backend/statistics/dependencies.c
@@ -409,7 +409,7 @@ statext_dependencies_build(int numrows, HeapTuple *rows, Bitmapset *attrs,
continue;
d = (MVDependency *) palloc0(offsetof(MVDependency, attributes)
- +k * sizeof(AttrNumber));
+ + k * sizeof(AttrNumber));
/* copy the dependency (and keep the indexes into stxkeys) */
d->degree = degree;
@@ -431,7 +431,7 @@ statext_dependencies_build(int numrows, HeapTuple *rows, Bitmapset *attrs,
dependencies->ndeps++;
dependencies = (MVDependencies *) repalloc(dependencies,
offsetof(MVDependencies, deps)
- +dependencies->ndeps * sizeof(MVDependency));
+ + dependencies->ndeps * sizeof(MVDependency));
dependencies->deps[dependencies->ndeps - 1] = d;
}
@@ -552,7 +552,7 @@ statext_dependencies_deserialize(bytea *data)
/* allocate space for the MCV items */
dependencies = repalloc(dependencies, offsetof(MVDependencies, deps)
- +(dependencies->ndeps * sizeof(MVDependency *)));
+ + (dependencies->ndeps * sizeof(MVDependency *)));
for (i = 0; i < dependencies->ndeps; i++)
{
@@ -573,7 +573,7 @@ statext_dependencies_deserialize(bytea *data)
/* now that we know the number of attributes, allocate the dependency */
d = (MVDependency *) palloc0(offsetof(MVDependency, attributes)
- +(k * sizeof(AttrNumber)));
+ + (k * sizeof(AttrNumber)));
d->degree = degree;
d->nattributes = k;
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 8d7460c96be..73d7ef3c271 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -353,7 +353,7 @@ multi_sort_init(int ndims)
Assert(ndims >= 2);
mss = (MultiSortSupport) palloc0(offsetof(MultiSortSupportData, ssup)
- +sizeof(SortSupportData) * ndims);
+ + sizeof(SortSupportData) * ndims);
mss->ndims = ndims;
diff --git a/src/backend/statistics/mvdistinct.c b/src/backend/statistics/mvdistinct.c
index d8d422cd45a..4b8d8926d29 100644
--- a/src/backend/statistics/mvdistinct.c
+++ b/src/backend/statistics/mvdistinct.c
@@ -166,7 +166,7 @@ statext_ndistinct_serialize(MVNDistinct *ndistinct)
* for each item, including number of items for each.
*/
len = VARHDRSZ + SizeOfMVNDistinct +
- ndistinct->nitems * (offsetof(MVNDistinctItem, attrs) +sizeof(int));
+ ndistinct->nitems * (offsetof(MVNDistinctItem, attrs) + sizeof(int));
/* and also include space for the actual attribute numbers */
for (i = 0; i < ndistinct->nitems; i++)
@@ -513,10 +513,10 @@ estimate_ndistinct(double totalrows, int numrows, int d, int f1)
denom,
ndistinct;
- numer = (double) numrows *(double) d;
+ numer = (double) numrows * (double) d;
denom = (double) (numrows - f1) +
- (double) f1 *(double) numrows / totalrows;
+ (double) f1 * (double) numrows / totalrows;
ndistinct = numer / denom;