summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/document/katehighlight.cpp
authorerik <erik>2007-01-19 01:12:38 (UTC)
committer erik <erik>2007-01-19 01:12:38 (UTC)
commit1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7 (patch) (unidiff)
treeaf4a12bc46e25853386dc53868b869e1bf05d863 /noncore/apps/tinykate/libkate/document/katehighlight.cpp
parent2b45dc71e79a3eb7d4e8553273c9bc4f4282d50a (diff)
downloadopie-1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7.zip
opie-1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7.tar.gz
opie-1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7.tar.bz2
Every single file in this commit had a memory leak where a resource is
allocated in the constructor but not de-allocated in the destructor. This commit fixes that.
Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katehighlight.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katehighlight.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp
index 539d356..89024f7 100644
--- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp
+++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp
@@ -376,39 +376,44 @@ const QChar *HlCFloat::checkHgl(const QChar *s, int len, bool lineStart) {
376 return s; 376 return s;
377} 377}
378 378
379HlAnyChar::HlAnyChar(int attribute, int context, const QChar* charList, uint len) 379HlAnyChar::HlAnyChar(int attribute, int context, const QChar* charList, uint len)
380 : HlItem(attribute, context) { 380 : HlItem(attribute, context) {
381 _charList=charList; 381 _charList=charList;
382 _charListLen=len; 382 _charListLen=len;
383} 383}
384 384
385const QChar *HlAnyChar::checkHgl(const QChar *s, int len, bool) 385const QChar *HlAnyChar::checkHgl(const QChar *s, int len, bool)
386{ 386{
387 if (ustrchr(_charList, _charListLen, *s)) return s +1; 387 if (ustrchr(_charList, _charListLen, *s)) return s +1;
388 return 0L; 388 return 0L;
389} 389}
390 390
391HlRegExpr::HlRegExpr(int attribute, int context,QString regexp) 391HlRegExpr::HlRegExpr(int attribute, int context,QString regexp)
392 : HlItem(attribute, context) { 392 : HlItem(attribute, context), Expr(0) {
393 393
394 handlesLinestart=regexp.startsWith("^"); 394 handlesLinestart=regexp.startsWith("^");
395 if(!handlesLinestart) regexp.prepend("^"); 395 if(!handlesLinestart) regexp.prepend("^");
396 Expr=new QRegExp3(regexp); 396 Expr=new QRegExp3(regexp);
397} 397}
398 398
399HlRegExpr::~HlRegExpr()
400{
401 delete Expr;
402}
403
399const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) 404const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart)
400{ 405{
401 if ((!lineStart) && handlesLinestart) return 0; 406 if ((!lineStart) && handlesLinestart) return 0;
402 407
403 QString line(s,len); 408 QString line(s,len);
404 int pos = Expr->search( line, 0 ); 409 int pos = Expr->search( line, 0 );
405 if (pos==-1) return 0L; 410 if (pos==-1) return 0L;
406 else 411 else
407 return (s+Expr->matchedLength()); 412 return (s+Expr->matchedLength());
408}; 413};
409 414
410 415
411HlLineContinue::HlLineContinue(int attribute, int context) 416HlLineContinue::HlLineContinue(int attribute, int context)
412 : HlItem(attribute,context) { 417 : HlItem(attribute,context) {
413} 418}
414 419