aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2023-10-15 08:40:37 +1100
committerNeil <nyamatongwe@gmail.com>2023-10-15 08:40:37 +1100
commit0a00f1b52c9f05800192db71ccc28dfaed58729b (patch)
tree1ef515f84fa935f8c3c14c98824522b0aba32112 /src
parent810883d3e039c92ce33372cc2e762615325b37f9 (diff)
downloadscintilla-mirror-0a00f1b52c9f05800192db71ccc28dfaed58729b.tar.gz
Use std::array for regex match positions as it will simplify copying.
This change set does not change behaviour.
Diffstat (limited to 'src')
-rw-r--r--src/Document.cxx1
-rw-r--r--src/RESearch.cxx7
-rw-r--r--src/RESearch.h7
3 files changed, 9 insertions, 6 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 94d126a70..0365b24db 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -16,6 +16,7 @@
#include <string>
#include <string_view>
#include <vector>
+#include <array>
#include <forward_list>
#include <optional>
#include <algorithm>
diff --git a/src/RESearch.cxx b/src/RESearch.cxx
index 9a2981ffe..98399c925 100644
--- a/src/RESearch.cxx
+++ b/src/RESearch.cxx
@@ -205,6 +205,7 @@
#include <stdexcept>
#include <string>
+#include <array>
#include <algorithm>
#include <iterator>
@@ -260,11 +261,11 @@ RESearch::RESearch(CharClassify *charClassTable) {
Clear();
}
-void RESearch::Clear() noexcept {
+void RESearch::Clear() {
+ bopat.fill(NOTFOUND);
+ eopat.fill(NOTFOUND);
for (int i = 0; i < MAXTAG; i++) {
pat[i].clear();
- bopat[i] = NOTFOUND;
- eopat[i] = NOTFOUND;
}
}
diff --git a/src/RESearch.h b/src/RESearch.h
index 34c6c46f9..c142441ae 100644
--- a/src/RESearch.h
+++ b/src/RESearch.h
@@ -21,7 +21,7 @@ class RESearch {
public:
explicit RESearch(CharClassify *charClassTable);
// No dynamic allocation so default copy constructor and assignment operator are OK.
- void Clear() noexcept;
+ void Clear();
void GrabMatches(const CharacterIndexer &ci);
const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept;
int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp);
@@ -29,8 +29,9 @@ public:
static constexpr int MAXTAG = 10;
static constexpr int NOTFOUND = -1;
- Sci::Position bopat[MAXTAG];
- Sci::Position eopat[MAXTAG];
+ using MatchPositions = std::array<Sci::Position, MAXTAG>;
+ MatchPositions bopat;
+ MatchPositions eopat;
std::string pat[MAXTAG];
private: