diff options
author | Neil <nyamatongwe@gmail.com> | 2019-03-03 15:35:54 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-03-03 15:35:54 +1100 |
commit | e55ed4dd7a0caf0b4a6fdb4e6e2b30e159e772d2 (patch) | |
tree | 0e16ee5421bb805ee7f330442c761d1332db8fee /src/PositionCache.cxx | |
parent | cb1710ea96ba303fcf62be5911c54137238906ce (diff) | |
download | scintilla-mirror-e55ed4dd7a0caf0b4a6fdb4e6e2b30e159e772d2.tar.gz |
Use noexcept where reasonable.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index b8829a571..aeb8d8bcf 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -99,7 +99,7 @@ void LineLayout::EnsureBidiData() { } } -void LineLayout::Free() { +void LineLayout::Free() noexcept { chars.reset(); styles.reset(); positions.reset(); @@ -391,7 +391,7 @@ void LineLayoutCache::AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesI PLATFORM_ASSERT(cache.size() == lengthForLevel); } -void LineLayoutCache::Deallocate() { +void LineLayoutCache::Deallocate() noexcept { PLATFORM_ASSERT(useCount == 0); cache.clear(); } @@ -409,7 +409,7 @@ void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) { } } -void LineLayoutCache::SetLevel(int level_) { +void LineLayoutCache::SetLevel(int level_) noexcept { allInvalidated = false; if ((level_ != -1) && (level != level_)) { level = level_; @@ -465,7 +465,7 @@ LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, return ret; } -void LineLayoutCache::Dispose(LineLayout *ll) { +void LineLayoutCache::Dispose(LineLayout *ll) noexcept { allInvalidated = false; if (ll) { if (!ll->inCache) { @@ -488,7 +488,7 @@ static unsigned int KeyFromString(const char *charBytes, size_t len) { return k; } -SpecialRepresentations::SpecialRepresentations() { +SpecialRepresentations::SpecialRepresentations() noexcept { const short none = 0; std::fill(startByteHasReprs, std::end(startByteHasReprs), none); } @@ -664,11 +664,11 @@ TextSegment BreakFinder::Next() { } } -bool BreakFinder::More() const { +bool BreakFinder::More() const noexcept { return (subBreak >= 0) || (nextBreak < lineRange.end); } -PositionCacheEntry::PositionCacheEntry() : +PositionCacheEntry::PositionCacheEntry() noexcept : styleNumber(0), len(0), clock(0), positions(nullptr) { } @@ -701,7 +701,7 @@ PositionCacheEntry::~PositionCacheEntry() { Clear(); } -void PositionCacheEntry::Clear() { +void PositionCacheEntry::Clear() noexcept { positions.reset(); styleNumber = 0; len = 0; @@ -721,7 +721,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, } } -unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) { +unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) noexcept { unsigned int ret = s[0] << 7; for (unsigned int i=0; i<len_; i++) { ret *= 1000003; @@ -734,11 +734,11 @@ unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, return ret; } -bool PositionCacheEntry::NewerThan(const PositionCacheEntry &other) const { +bool PositionCacheEntry::NewerThan(const PositionCacheEntry &other) const noexcept { return clock > other.clock; } -void PositionCacheEntry::ResetClock() { +void PositionCacheEntry::ResetClock() noexcept { if (clock > 0) { clock = 1; } @@ -754,7 +754,7 @@ PositionCache::~PositionCache() { Clear(); } -void PositionCache::Clear() { +void PositionCache::Clear() noexcept { if (!allClear) { for (PositionCacheEntry &pce : pces) { pce.Clear(); |