mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-16 10:17:23 +00:00
ICU-3423 fix problems in RegexPattern assignment/copy/clone
X-SVN-Rev: 14255
This commit is contained in:
parent
a4b350dfa9
commit
f21db4aa62
2 changed files with 17 additions and 11 deletions
|
@ -75,15 +75,18 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
|
|||
fLiteralText = other.fLiteralText;
|
||||
fDeferredStatus = other.fDeferredStatus;
|
||||
fMinMatchLen = other.fMinMatchLen;
|
||||
fFrameSize = other.fFrameSize;
|
||||
fDataSize = other.fDataSize;
|
||||
fMaxCaptureDigits = other.fMaxCaptureDigits;
|
||||
fStaticSets = other.fStaticSets;
|
||||
fStaticSets8 = other.fStaticSets8;
|
||||
|
||||
fStartType = other.fStartType;
|
||||
fInitialStringIdx = other.fInitialStringIdx;
|
||||
fInitialStringLen = other.fInitialStringLen;
|
||||
*fInitialChars = *other.fInitialChars;
|
||||
*fInitialChars8 = *other.fInitialChars8;
|
||||
fInitialChar = other.fInitialChar;
|
||||
*fInitialChars8 = *other.fInitialChars8;
|
||||
|
||||
// Copy the pattern. It's just values, nothing deep to copy.
|
||||
fCompiledPat->assign(*other.fCompiledPat, fDeferredStatus);
|
||||
|
@ -121,20 +124,26 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
|
|||
//
|
||||
//--------------------------------------------------------------------------
|
||||
void RegexPattern::init() {
|
||||
fPattern.remove();
|
||||
fFlags = 0;
|
||||
fCompiledPat = 0;
|
||||
fLiteralText.remove();
|
||||
fSets = NULL;
|
||||
fSets8 = NULL;
|
||||
fDeferredStatus = U_ZERO_ERROR;
|
||||
fMinMatchLen = 0;
|
||||
fMaxCaptureDigits = 1;
|
||||
fStaticSets = NULL;
|
||||
fFrameSize = 0;
|
||||
fDataSize = 0;
|
||||
fGroupMap = NULL;
|
||||
fMaxCaptureDigits = 1;
|
||||
fStaticSets = NULL;
|
||||
fStaticSets8 = NULL;
|
||||
fStartType = START_NO_INFO;
|
||||
fInitialStringIdx = 0;
|
||||
fInitialStringLen = 0;
|
||||
fInitialChars = NULL;
|
||||
fInitialChars8 = NULL;
|
||||
fInitialChar = 0;
|
||||
fSets8 = NULL;
|
||||
fInitialChars8 = NULL;
|
||||
|
||||
fCompiledPat = new UVector32(fDeferredStatus);
|
||||
fGroupMap = new UVector32(fDeferredStatus);
|
||||
|
@ -173,14 +182,14 @@ void RegexPattern::zap() {
|
|||
}
|
||||
delete fSets;
|
||||
fSets = NULL;
|
||||
delete[] fSets8;
|
||||
fSets8 = NULL;
|
||||
delete fGroupMap;
|
||||
fGroupMap = NULL;
|
||||
delete fInitialChars;
|
||||
fInitialChars = NULL;
|
||||
delete fInitialChars8;
|
||||
fInitialChars8 = NULL;
|
||||
delete[] fSets8;
|
||||
fSets8 = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1071,7 +1071,7 @@ void RegexTest::API_Pattern() {
|
|||
REGEX_ASSERT(*pat1a == *pat1);
|
||||
|
||||
REGEX_ASSERT(pat1a->flags() == 0);
|
||||
#if 0
|
||||
|
||||
// Compile with different flags should be not equal
|
||||
RegexPattern *pat1b = RegexPattern::compile(re1, UREGEX_CASE_INSENSITIVE, pe, status);
|
||||
REGEX_CHECK_STATUS;
|
||||
|
@ -1080,7 +1080,6 @@ void RegexTest::API_Pattern() {
|
|||
REGEX_ASSERT(pat1b->flags() == UREGEX_CASE_INSENSITIVE);
|
||||
REGEX_ASSERT(pat1a->flags() == 0);
|
||||
delete pat1b;
|
||||
#endif // add test back in when we actually support flag settings.
|
||||
|
||||
// clone
|
||||
RegexPattern *pat1c = pat1->clone();
|
||||
|
@ -1097,7 +1096,6 @@ void RegexTest::API_Pattern() {
|
|||
// Verify that a matcher created from a cloned pattern works.
|
||||
// (Jitterbug 3423)
|
||||
//
|
||||
#if 0
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
RegexPattern *pSource = RegexPattern::compile("\\p{L}+", 0, status);
|
||||
|
@ -1115,7 +1113,6 @@ void RegexTest::API_Pattern() {
|
|||
delete mFromClone;
|
||||
delete pClone;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// matches convenience API
|
||||
|
|
Loading…
Add table
Reference in a new issue