diff options
author | Neil <nyamatongwe@gmail.com> | 2017-05-01 14:03:31 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-05-01 14:03:31 +1000 |
commit | 782ada0bab34bb56c4023c070e6eb355ca32cdf2 (patch) | |
tree | 934d93284fdf214b2761097308252838bb9a9f6f /src/ContractionState.cxx | |
parent | 102a874a3a8ca376e08d1319b36833297bea39ae (diff) | |
download | scintilla-mirror-782ada0bab34bb56c4023c070e6eb355ca32cdf2.tar.gz |
Use std::unique_ptr to simplify ContractionState.
Diffstat (limited to 'src/ContractionState.cxx')
-rw-r--r-- | src/ContractionState.cxx | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 616f6bb87..60042bf88 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -26,8 +26,7 @@ using namespace Scintilla; #endif -ContractionState::ContractionState() : visible(0), expanded(0), heights(0), foldDisplayTexts(0), displayLines(0), linesInDocument(1) { - //InsertLine(0); +ContractionState::ContractionState() : linesInDocument(1) { } ContractionState::~ContractionState() { @@ -36,26 +35,21 @@ ContractionState::~ContractionState() { void ContractionState::EnsureData() { if (OneToOne()) { - visible = new RunStyles(); - expanded = new RunStyles(); - heights = new RunStyles(); - foldDisplayTexts = new SparseVector<const char *>(); - displayLines = new Partitioning(4); + visible.reset(new RunStyles()); + expanded.reset(new RunStyles()); + heights.reset(new RunStyles()); + foldDisplayTexts.reset(new SparseVector<const char *>()); + displayLines.reset(new Partitioning(4)); InsertLines(0, linesInDocument); } } void ContractionState::Clear() { - delete visible; - visible = 0; - delete expanded; - expanded = 0; - delete heights; - heights = 0; - delete foldDisplayTexts; - foldDisplayTexts = 0; - delete displayLines; - displayLines = 0; + visible.reset(); + expanded.reset(); + heights.reset(); + foldDisplayTexts.reset(); + displayLines.reset(); linesInDocument = 1; } |