mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
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:
parent
f276dbc06b
commit
1d34a121e9
47 changed files with 1180 additions and 537 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue