diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-02-17 14:16:01 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-02-18 10:25:04 +0100 |
commit | 6022688413e0c00c74aeae0820a324342217ff58 (patch) | |
tree | a5908b73e8b1dfa7f9cee1ca4a69dd30882d05b8 /crawl-ref/source/util/unbrace | |
parent | dbc77522b9efab96f0a6616d1cff8330451072f1 (diff) | |
download | crawl-ref-6022688413e0c00c74aeae0820a324342217ff58.tar.gz crawl-ref-6022688413e0c00c74aeae0820a324342217ff58.zip |
Skip unnecessary overwrites during bracecidating.
Diffstat (limited to 'crawl-ref/source/util/unbrace')
-rwxr-xr-x | crawl-ref/source/util/unbrace | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crawl-ref/source/util/unbrace b/crawl-ref/source/util/unbrace index 13866cb919..a2d4e3395b 100755 --- a/crawl-ref/source/util/unbrace +++ b/crawl-ref/source/util/unbrace @@ -4,7 +4,7 @@ undef $/; for $f (grep /\.(cc|h)$/, split /\n/, `git ls-files`) { open F, "<", $f or die "Can't read $f\n"; - $_ = <F>; + my $old = $_ = <F>; close F; # Aaaw, due to the support code, this beautiful one-liner is one no longer :( @@ -13,7 +13,11 @@ for $f (grep /\.(cc|h)$/, split /\n/, `git ls-files`) # like I always did before... s&^( +(?:if|while|for|do|else)\b[^\n]*)\n +{\n( *[^/ }][^\n]*)\n +}$&$1\n$2&msg; - open F, ">", $f or die "Can't write $f\n"; - print F; - close F; + if ($old ne $_) + { + print "$f\n"; + open F, ">", $f or die "Can't write $f\n"; + print F; + close F; + } } |