Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

scintilla_rev4065.patch

By: a guest on Mar 22nd, 2012  |  syntax: Diff  |  size: 2.29 KB  |  views: 35  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # HG changeset patch
  2. # User Jerome LAFORGE <jerome.laforge@gmail.com>
  3. # Date 1332436364 -3600
  4. # Node ID be3ff3976c76c0649a4a87c380ecf55527cad00c
  5. # Parent  0b5108e724453610d7692dae038c0ae6db59bf7a
  6. Use SpareVectore instead of std::vector.
  7. Cleaning dead code.
  8. Feature #3510158.
  9.  
  10. diff -r 0b5108e72445 -r be3ff3976c76 lexers/LexSQL.cxx
  11. --- a/lexers/LexSQL.cxx mer. mars 21 23:39:03 2012 +1100
  12. +++ b/lexers/LexSQL.cxx jeu. mars 22 18:12:44 2012 +0100
  13. @@ -30,6 +30,7 @@
  14.  #include "CharacterSet.h"
  15.  #include "LexerModule.h"
  16.  #include "OptionSet.h"
  17. +#include "SparseState.h"
  18.  
  19.  #ifdef SCI_NAMESPACE
  20.  using namespace Scintilla;
  21. @@ -65,10 +66,7 @@
  22.  class SQLStates {
  23.  public :
  24.         void Set(int lineNumber, unsigned short int sqlStatesLine) {
  25. -               if (!sqlStatement.size() == 0 || !sqlStatesLine == 0) {
  26. -                       sqlStatement.resize(lineNumber + 1, 0);
  27. -                       sqlStatement[lineNumber] = sqlStatesLine;
  28. -               }
  29. +               sqlStatement.Set(lineNumber, sqlStatesLine);
  30.         }
  31.  
  32.         unsigned short int IgnoreWhen (unsigned short int sqlStatesLine, bool enable) {
  33. @@ -181,17 +179,13 @@
  34.         }
  35.  
  36.         unsigned short int ForLine(int lineNumber) {
  37. -               if ((lineNumber > 0) && (sqlStatement.size() > static_cast<size_t>(lineNumber))) {
  38. -                       return sqlStatement[lineNumber];
  39. -               } else {
  40. -                       return 0;
  41. -               }
  42. +               return sqlStatement.ValueAt(lineNumber);
  43.         }
  44.  
  45.         SQLStates() {}
  46.  
  47.  private :
  48. -       std::vector <unsigned short int> sqlStatement;
  49. +       SparseState <unsigned short int> sqlStatement;
  50.         enum {
  51.                 MASK_NESTED_CASES = 0x01FF,
  52.                 MASK_INTO_SELECT_STATEMENT = 0x0200,
  53. @@ -610,7 +604,6 @@
  54.                                 if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine))
  55.                                         levelNext--;
  56.                                 sqlStatesCurrentLine = sqlStates.IntoMergeStatement(sqlStatesCurrentLine, false);
  57. -                               //sqlStatesCurrentLine = sqlStates.WhenThenFound(sqlStatesCurrentLine, false);
  58.                                 levelNext--;
  59.                         }
  60.                         if (sqlStates.IsIntoSelectStatement(sqlStatesCurrentLine))
  61. @@ -722,7 +715,6 @@
  62.                                                 sqlStatesCurrentLine = sqlStates.EndCaseBlock(sqlStatesCurrentLine);
  63.                                                 if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine))
  64.                                                         levelNext--; //again for the "end case;" and block when
  65. -                                               //sqlStatesCurrentLine = sqlStates.WhenThenFound(sqlStatesCurrentLine, false);
  66.                                         }
  67.                                 } else if (!options.foldOnlyBegin) {
  68.                                         if (strcmp(s, "case") == 0)