diff options
author | Zufu Liu <unknown> | 2023-11-07 14:14:13 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2023-11-07 14:14:13 +1100 |
commit | befae293448be75d5e10c689bcd787ab0d19fb2c (patch) | |
tree | 947523ca8106d711212f37120570a9d1160f09ca | |
parent | e7216769dbeaa7e39262087f02ef8352253f1c03 (diff) | |
download | scintilla-mirror-befae293448be75d5e10c689bcd787ab0d19fb2c.tar.gz |
Feature [feature-requests:#1501] Use const and simpler indexing.
-rw-r--r-- | src/RESearch.cxx | 10 | ||||
-rw-r--r-- | src/RESearch.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/RESearch.cxx b/src/RESearch.cxx index 8fe3724c8..ca0f1b552 100644 --- a/src/RESearch.cxx +++ b/src/RESearch.cxx @@ -745,7 +745,7 @@ const char *RESearch::Compile(const char *pattern, Sci::Position length, bool ca int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp) { unsigned char c = 0; Sci::Position ep = NOTFOUND; - char *ap = nfa; + const char * const ap = nfa; bol = lp; failure = 0; @@ -758,7 +758,7 @@ int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Positio ep = PMatch(ci, lp, endp, ap); break; case EOL: /* just searching for end of line normal path doesn't work */ - if (*(ap+1) == END) { + if (ap[1] == END) { lp = endp; ep = lp; break; @@ -766,7 +766,7 @@ int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Positio return 0; } case CHR: /* ordinary char: locate it fast */ - c = *(ap+1); + c = ap[1]; while ((lp < endp) && (static_cast<unsigned char>(ci.CharAt(lp)) != c)) lp++; if (lp >= endp) /* if EOS, fail, else fall through. */ @@ -830,7 +830,7 @@ int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Positio #define CHRSKIP 3 /* [CLO] CHR chr END */ #define CCLSKIP 34 /* [CLO] CCL 32 bytes END */ -Sci::Position RESearch::PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap) { +Sci::Position RESearch::PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, const char *ap) { int op = 0; int c = 0; int n = 0; @@ -904,7 +904,7 @@ Sci::Position RESearch::PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci n = ANYSKIP; break; case CHR: - c = *(ap+1); + c = ap[1]; if (op == CLO || op == LCLO) while ((lp < endp) && (c == ci.CharAt(lp))) lp++; diff --git a/src/RESearch.h b/src/RESearch.h index 37f210e13..05bc0e093 100644 --- a/src/RESearch.h +++ b/src/RESearch.h @@ -45,7 +45,7 @@ private: void ChSetWithCase(unsigned char c, bool caseSensitive) noexcept; int GetBackslashExpression(const char *pattern, int &incr) noexcept; - Sci::Position PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap); + Sci::Position PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, const char *ap); Sci::Position bol; Sci::Position tagstk[MAXTAG]; /* subpat tag stack */ |