From: Pino Toscano Date: Sat, 1 Sep 2007 23:57:03 +0000 (+0000) Subject: do not leak the document, allocating on the stack is enough X-Git-Tag: v3.94.0~86 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=7206c5db7122ec662f1cb1792244d040bb23a500;p=libqmvoc.git do not leak the document, allocating on the stack is enough just check whether the list is not empty, no need to know the size svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=707493 --- diff --git a/keduvocdocument/sharedkvtmlfiles.cpp b/keduvocdocument/sharedkvtmlfiles.cpp index 98a2c8b..702cab4 100644 --- a/keduvocdocument/sharedkvtmlfiles.cpp +++ b/keduvocdocument/sharedkvtmlfiles.cpp @@ -158,15 +158,15 @@ void SharedKvtmlFiles::sortDownloadedFiles() QStringList unsortedFiles = KGlobal::dirs()->findAllResources( "data", QString( "kvtml/*.kvtml" ) ); - KEduVocDocument *doc = new KEduVocDocument(); + KEduVocDocument doc; - while ( unsortedFiles.size() > 0 ) { + while ( !unsortedFiles.isEmpty() ) { KUrl fileUrl( KUrl::fromPath( unsortedFiles.first() ) ); // find the file's locale // open the file - doc->open( fileUrl ); + doc.open( fileUrl ); - QString locale = doc->identifier( 0 ).name(); + QString locale = doc.identifier( 0 ).name(); // make sure the locale sub-folder exists KUrl pathUrl( fileUrl );