summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qregexp.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-04 11:17:47 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-04 11:17:47 (GMT)
commitbe212bf108e71ba3b5b75802b1f4de6613ba315c (patch)
treec541ad12e8698f04e8fe386c2e1b94e8baca6c1b /src/corelib/tools/qregexp.cpp
parent67ae1b0dac175f48875507f3187ed49276a29ddf (diff)
parente6bb00250b321b149dd80259dc4f479088d5949b (diff)
downloadQt-be212bf108e71ba3b5b75802b1f4de6613ba315c.zip
Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.gz
Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.bz2
Merge commit 'origin/master'
Conflicts: src/corelib/global/qglobal.h src/corelib/kernel/qmetatype.cpp src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/gui/graphicsview/qgraphicssceneevent.h src/gui/itemviews/qheaderview.h src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qgesture.h src/gui/kernel/qgesturerecognizer.h src/gui/painting/qpaintengine_raster.cpp src/network/access/qhttpnetworkreply.cpp src/network/access/qnetworkcookie.h src/network/socket/qnativesocketengine_unix.cpp
Diffstat (limited to 'src/corelib/tools/qregexp.cpp')
-rw-r--r--src/corelib/tools/qregexp.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 8bda634..0ac4fa2 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1225,7 +1225,7 @@ private:
int yyPos; // the position of the next character to read
int yyLen; // the length of yyIn
int yyCh; // the last character read
- QRegExpCharClass *yyCharClass; // attribute for Tok_CharClass tokens
+ QScopedPointer<QRegExpCharClass> yyCharClass; // attribute for Tok_CharClass tokens
int yyMinRep; // attribute for Tok_Quantifier
int yyMaxRep; // ditto
QString yyError; // syntax error or overflow during parsing?
@@ -1316,8 +1316,7 @@ void QRegExpMatchState::prepareForMatch(QRegExpEngine *eng)
#endif
int numCaptures = eng->numCaptures();
int newCapturedSize = 2 + 2 * numCaptures;
- bigArray = (int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int));
- Q_CHECK_PTR(bigArray);
+ bigArray = q_check_ptr((int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int)));
// set all internal variables only _after_ bigArray is realloc'ed
// to prevent a broken regexp in oom case
@@ -3124,7 +3123,7 @@ void QRegExpEngine::startTokenizer(const QChar *rx, int len)
yyPos = 0;
yyLen = len;
yyCh = getChar();
- yyCharClass = new QRegExpCharClass;
+ yyCharClass.reset(new QRegExpCharClass);
yyMinRep = 0;
yyMaxRep = 0;
yyError = QString();
@@ -3318,8 +3317,7 @@ int QRegExpEngine::parse(const QChar *pattern, int len)
#endif
box.cat(middleBox);
box.cat(rightBox);
- delete yyCharClass;
- yyCharClass = 0;
+ yyCharClass.reset(0);
#ifndef QT_NO_REGEXP_CAPTURE
for (int i = 0; i < nf; ++i) {