apply all-man braces in Phobos

// find common cases
sed -E "s/^(\s*)((if|static if|for|foreach|foreach_reverse|while|unittest|switch|else|version).*)\s*\{$/\1\2\n\1{/" -i **/*.d
// catch else-if
sed -E "s/^(\s*)} (else static if| if|else if|else)(.*)\s*\{$/\1}\n\1\2\3\n\1{/" -i **/*.d
// remove created trailing whitespace
sed -i 's/[ \t]*$//' **/*.d
This commit is contained in:
Sebastian Wilzbach 2016-05-31 05:30:02 +02:00
parent f276dbc06b
commit 1d34a121e9
47 changed files with 1180 additions and 537 deletions

View file

@ -923,13 +923,15 @@ private struct Levenshtein(Range, alias equals, CostType = size_t)
EditOp[] result;
size_t i = rows - 1, j = cols - 1;
// restore the path
while (i || j) {
while (i || j)
{
auto cIns = j == 0 ? CostType.max : matrix(i,j - 1);
auto cDel = i == 0 ? CostType.max : matrix(i - 1,j);
auto cSub = i == 0 || j == 0
? CostType.max
: matrix(i - 1,j - 1);
switch (min_index(cSub, cIns, cDel)) {
switch (min_index(cSub, cIns, cDel))
{
case 0:
result ~= matrix(i - 1,j - 1) == matrix(i,j)
? EditOp.none
@ -968,7 +970,8 @@ private:
void AllocMatrix(size_t r, size_t c) @trusted {
rows = r;
cols = c;
if (_matrix.length < r * c) {
if (_matrix.length < r * c)
{
import core.stdc.stdlib : realloc;
import core.exception : onOutOfMemoryError;
auto m = cast(CostType *)realloc(_matrix.ptr, r * c * _matrix[0].sizeof);