Merge branch '46-add-curly-braces' into 'master'
Add curly braces using uncrustify and then reformat with clang-format back Closes #46 See merge request isc-projects/bind9!3057 (cherry picked from commit67b68e06ad)36c6105eUse coccinelle to add braces to nested single line statementd14bb713Add copy of run-clang-tidy that can fixup the filepaths056e133cUse clang-tidy to add curly braces around one-line statements
This commit is contained in:
@@ -105,11 +105,13 @@ igamc(double a, double x)
|
||||
double ans, ax, c, yc, r, t, y, z;
|
||||
double pk, pkm1, pkm2, qk, qkm1, qkm2;
|
||||
|
||||
if ((x <= 0) || (a <= 0))
|
||||
if ((x <= 0) || (a <= 0)) {
|
||||
return (1.0);
|
||||
}
|
||||
|
||||
if ((x < 1.0) || (x < a))
|
||||
if ((x < 1.0) || (x < a)) {
|
||||
return (1.0 - igam(a, x));
|
||||
}
|
||||
|
||||
ax = a * log(x) - x - lgamma(a);
|
||||
if (ax < -MAXLOG) {
|
||||
@@ -139,8 +141,9 @@ igamc(double a, double x)
|
||||
r = pk / qk;
|
||||
t = fabs((ans - r) / r);
|
||||
ans = r;
|
||||
} else
|
||||
} else {
|
||||
t = 1.0;
|
||||
}
|
||||
|
||||
pkm2 = pkm1;
|
||||
pkm1 = pk;
|
||||
@@ -163,11 +166,13 @@ igam(double a, double x)
|
||||
{
|
||||
double ans, ax, c, r;
|
||||
|
||||
if ((x <= 0) || (a <= 0))
|
||||
if ((x <= 0) || (a <= 0)) {
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
if ((x > 1.0) && (x > a))
|
||||
if ((x > 1.0) && (x > a)) {
|
||||
return (1.0 - igamc(a, x));
|
||||
}
|
||||
|
||||
/* Compute x**a * exp(-x) / md_gamma(a) */
|
||||
ax = a * log(x) - x - lgamma(a);
|
||||
@@ -205,10 +210,11 @@ scount_calculate(uint16_t n)
|
||||
uint16_t lsb;
|
||||
|
||||
lsb = n & 1;
|
||||
if (lsb != 0)
|
||||
if (lsb != 0) {
|
||||
sc += 1;
|
||||
else
|
||||
} else {
|
||||
sc -= 1;
|
||||
}
|
||||
|
||||
n >>= 1;
|
||||
}
|
||||
@@ -227,8 +233,9 @@ bitcount_calculate(uint16_t n)
|
||||
uint16_t lsb;
|
||||
|
||||
lsb = n & 1;
|
||||
if (lsb != 0)
|
||||
if (lsb != 0) {
|
||||
bc += 1;
|
||||
}
|
||||
|
||||
n >>= 1;
|
||||
}
|
||||
@@ -268,9 +275,9 @@ matrix_binaryrank(uint32_t *bits, size_t rows, size_t cols)
|
||||
while (rt >= cols || ((bits[i] >> rt) & 1) == 0) {
|
||||
i++;
|
||||
|
||||
if (i < rows)
|
||||
if (i < rows) {
|
||||
continue;
|
||||
else {
|
||||
} else {
|
||||
rt++;
|
||||
if (rt < cols) {
|
||||
i = k;
|
||||
@@ -289,10 +296,11 @@ matrix_binaryrank(uint32_t *bits, size_t rows, size_t cols)
|
||||
}
|
||||
|
||||
for (j = i + 1; j < rows; j++) {
|
||||
if (((bits[j] >> rt) & 1) == 0)
|
||||
if (((bits[j] >> rt) & 1) == 0) {
|
||||
continue;
|
||||
else
|
||||
} else {
|
||||
bits[j] ^= bits[k];
|
||||
}
|
||||
}
|
||||
|
||||
rt++;
|
||||
@@ -452,8 +460,9 @@ monobit(isc_mem_t *mctx, uint16_t *values, size_t length)
|
||||
numbits = length * sizeof(*values) * 8;
|
||||
scount = 0;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < length; i++) {
|
||||
scount += scounts_table[values[i]];
|
||||
}
|
||||
|
||||
/* Preconditions (section 2.1.7 in NIST SP 800-22) */
|
||||
assert_true(numbits >= 100);
|
||||
@@ -493,8 +502,9 @@ runs(isc_mem_t *mctx, uint16_t *values, size_t length)
|
||||
numbits = length * sizeof(*values) * 8;
|
||||
bcount = 0;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < length; i++) {
|
||||
bcount += bitcounts_table[values[i]];
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
print_message("# numbits=%u, bcount=%u\n", numbits, bcount);
|
||||
@@ -511,8 +521,9 @@ runs(isc_mem_t *mctx, uint16_t *values, size_t length)
|
||||
* for some sequences, and the p-value is taken as 0 in these
|
||||
* cases.
|
||||
*/
|
||||
if (fabs(pi - 0.5) >= tau)
|
||||
if (fabs(pi - 0.5) >= tau) {
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/* Compute v_obs */
|
||||
j = 0;
|
||||
@@ -594,8 +605,9 @@ blockfrequency(isc_mem_t *mctx, uint16_t *values, size_t length)
|
||||
|
||||
/* Compute chi_square */
|
||||
chi_square = 0.0;
|
||||
for (i = 0; i < numblocks; i++)
|
||||
for (i = 0; i < numblocks; i++) {
|
||||
chi_square += (pi[i] - 0.5) * (pi[i] - 0.5);
|
||||
}
|
||||
|
||||
chi_square *= 4 * mbits;
|
||||
|
||||
@@ -670,12 +682,13 @@ binarymatrixrank(isc_mem_t *mctx, uint16_t *values, size_t length)
|
||||
|
||||
rank = matrix_binaryrank(bits, matrix_m, matrix_q);
|
||||
|
||||
if (rank == matrix_m)
|
||||
if (rank == matrix_m) {
|
||||
fm_0++;
|
||||
else if (rank == (matrix_m - 1))
|
||||
} else if (rank == (matrix_m - 1)) {
|
||||
fm_1++;
|
||||
else
|
||||
} else {
|
||||
fm_rest++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute chi_square */
|
||||
@@ -906,4 +919,4 @@ main(void)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* if HAVE_CMOCKA */
|
||||
|
||||
Reference in New Issue
Block a user