[colorer/Colorer-library] cregexp_refactoring: Build CRegExp ReWord nodes with UnicodeString::append instead of a temporary buffer. (df12235)

0 views
Skip to first unread message

farg...@farmanager.com

unread,
Aug 16, 2026, 3:31:18 PM (12 hours ago) Aug 16
to farco...@googlegroups.com
Repository : https://github.com/colorer/Colorer-library
On branch : cregexp_refactoring
Link : https://github.com/colorer/Colorer-library/commit/df1223578bfaf2a125dead364d368c33167756b8

>---------------------------------------------------------------

commit df1223578bfaf2a125dead364d368c33167756b8
Author: Aleksey Dobrunov <cta...@ctapmex.com>
Date: Sun Aug 16 23:03:53 2026 +0500

Build CRegExp ReWord nodes with UnicodeString::append instead of a temporary buffer.


>---------------------------------------------------------------

df1223578bfaf2a125dead364d368c33167756b8
src/colorer/cregexp/cregexp.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/colorer/cregexp/cregexp.cpp b/src/colorer/cregexp/cregexp.cpp
index 4d44823..9f1178c 100644
--- a/src/colorer/cregexp/cregexp.cpp
+++ b/src/colorer/cregexp/cregexp.cpp
@@ -695,9 +695,9 @@ EError CRegExp::setStructs(SRegInfo*& re, const UnicodeString& expr, int from, i
if (wsize > 1) {
reafterword = resymb;
resymb = reword;
- UChar* wcword = new UChar[wsize];
+ auto* word = new UnicodeString();
for (int idx = 0; idx < wsize; idx++) {
- wcword[idx] = resymb->un.symbol;
+ word->append(resymb->un.symbol);
SRegInfo* retmp = resymb;
resymb = resymb->next;
retmp->next = nullptr;
@@ -705,8 +705,7 @@ EError CRegExp::setStructs(SRegInfo*& re, const UnicodeString& expr, int from, i
delete retmp;
}
reword->op = EOps::ReWord;
- reword->un.word = new UnicodeString(wcword, wsize);
- delete[] wcword;
+ reword->un.word = word;
reword->next = reafterword;
if (reafterword)
reafterword->prev = reword;


Reply all
Reply to author
Forward
0 new messages