1. 08 Jan, 2013 1 commit
    • Orgad Shaneh's avatar
      Remove braces for single lines of conditions · 29a93998
      Orgad Shaneh authored
      
      
      #!/usr/bin/env ruby
      
      Dir.glob('**/*.cpp') { |file|
        # skip ast (excluding paste, astpath, and canv'ast'imer)
        next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
        s = File.read(file)
        next if s.include?('qlalr')
        orig = s.dup
        s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
          res = $&
          if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
            res
          else
            res.gsub!('} else', 'else')
            res.gsub!(/\n +} *\n/m, "\n")
            res.gsub(/ *{$/, '')
          end
        }
        s.gsub!(/ *$/, '')
        File.open(file, 'wb').write(s) if s != orig
      }
      
      Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
      Reviewed-by: default avatarhjk <qthjk@ovi.com>
      29a93998
  2. 20 Dec, 2012 1 commit
  3. 06 Dec, 2012 1 commit
  4. 28 Nov, 2012 2 commits
  5. 21 Nov, 2012 1 commit
  6. 05 Oct, 2012 1 commit
  7. 04 Oct, 2012 1 commit
  8. 01 Oct, 2012 2 commits
  9. 25 Sep, 2012 1 commit
  10. 03 Sep, 2012 1 commit
  11. 22 Aug, 2012 2 commits
  12. 06 Aug, 2012 1 commit
  13. 19 Jul, 2012 1 commit
  14. 23 Mar, 2012 1 commit
  15. 15 Feb, 2012 1 commit
  16. 26 Jan, 2012 1 commit
  17. 21 Nov, 2011 1 commit
  18. 09 Nov, 2011 2 commits
  19. 03 Nov, 2011 1 commit
  20. 25 Oct, 2011 1 commit
  21. 20 Oct, 2011 2 commits
  22. 13 Oct, 2011 1 commit
  23. 20 Sep, 2011 2 commits
  24. 19 Sep, 2011 2 commits
  25. 16 Sep, 2011 1 commit
  26. 12 Sep, 2011 2 commits
  27. 06 Sep, 2011 1 commit
  28. 27 Jul, 2011 1 commit
  29. 21 Jul, 2011 1 commit
  30. 20 Jul, 2011 2 commits
  31. 15 Jul, 2011 1 commit