Skip to content

Commit

Permalink
Remove redundant regex.reset() after character class data changed
Browse files Browse the repository at this point in the history
as they will only be called after document code page changed.
  • Loading branch information
zufuliu committed Oct 15, 2023
1 parent f4f2132 commit 5be563a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions scintilla/src/Document.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ bool Document::SetDBCSCodePage(int dbcsCodePage_) {
cb.SetLineEndTypes(lineEndBitSet & LineEndTypesSupported());
cb.SetUTF8Substance(CpUtf8 == dbcsCodePage);
dbcsCharClass = GetDBCSCharClassify(dbcsCodePage);
#if defined(BOOST_REGEX_STANDALONE) || !defined(NO_CXX11_REGEX)
regex.reset();
#endif
ModifiedAt(0); // Need to restyle whole document
return true;
} else {
Expand Down Expand Up @@ -2155,9 +2153,9 @@ Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, con
//const bool forward = direction >= 0;
const int increment = (direction >= 0) ? 1 : -1;
// table for the condition: forward ? (pos < endSearch) : (pos >= endSearch)
// direction >= 0 direction < 0
// pos >= endSearch: break continue
// pos < endSearch: continue break
// direction >= 0 direction < 0
// pos >= endSearch: break continue
// pos < endSearch: continue break
// i.e. continue search when direction and (pos - endSearch) have opposite signs,
// which can be wrote as: (direction ^ (pos - endSearch)) < 0

Expand Down Expand Up @@ -2425,21 +2423,18 @@ void Document::AllocateLines(Sci::Line lines) {

void Document::SetDefaultCharClasses(bool includeWordClass) noexcept {
charClass.SetDefaultCharClasses(includeWordClass);
regex.reset();
}

void Document::SetCharClasses(const unsigned char *chars, CharacterClass newCharClass) noexcept {
charClass.SetCharClasses(chars, newCharClass);
regex.reset();
}

void Document::SetCharClassesEx(const unsigned char *chars, size_t length) noexcept {
charClass.SetCharClassesEx(chars, length);
regex.reset();
}

int Document::GetCharsOfClass(CharacterClass characterClass, unsigned char *buffer) const noexcept {
return charClass.GetCharsOfClass(characterClass, buffer);
return charClass.GetCharsOfClass(characterClass, buffer);
}

#if 0
Expand Down

0 comments on commit 5be563a

Please sign in to comment.