diff options
Diffstat (limited to 'tool/auto-style.rb')
-rwxr-xr-x | tool/auto-style.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tool/auto-style.rb b/tool/auto-style.rb index 7e66f376ec..0c6ce6848a 100755 --- a/tool/auto-style.rb +++ b/tool/auto-style.rb @@ -233,11 +233,10 @@ edited_files = files.select do |f| if File.fnmatch?("*.[ch]", f, File::FNM_PATHNAME) && !DIFFERENT_STYLE_FILES.any? {|pat| File.fnmatch?(pat, f, File::FNM_PATHNAME)} - orig = src.dup - src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n") - src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1') - src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '') - indent = indent0 = src != orig + indent0 = true if src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n") + indent0 = true if src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1') + indent0 = true if src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '') + indent ||= indent0 end if trailing0 or eofnewline0 or expandtab0 or indent0 |