]> Git trees. - libqmvoc.git/commitdiff
do not leak the document, allocating on the stack is enough
authorPino Toscano <pino@kde.org>
Sat, 1 Sep 2007 23:57:03 +0000 (23:57 +0000)
committerPino Toscano <pino@kde.org>
Sat, 1 Sep 2007 23:57:03 +0000 (23:57 +0000)
just check whether the list is not empty, no need to know the size

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=707493

keduvocdocument/sharedkvtmlfiles.cpp

index 98a2c8b6e7ec32ed6773cc8cb3049e7772df8bab..702cab4f0e428cb3f65700873f2d61eb7ddf40bc 100644 (file)
@@ -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 );