src/file.cpp

changeset 503
bebe09014dd6
parent 500
cad8cdc42a64
child 504
6a1fa662bfc1
--- a/src/file.cpp	Wed Oct 16 16:05:51 2013 +0300
+++ b/src/file.cpp	Wed Oct 16 16:40:42 2013 +0300
@@ -133,12 +133,7 @@
 		delete obj;
 
 	// Remove this file from the list of files
-	for (int i = 0; i < g_loadedFiles.size(); ++i)
-	{	if (g_loadedFiles[i] == this)
-		{	g_loadedFiles.erase (i);
-			break;
-		}
-	}
+	g_loadedFiles.removeOne (this);
 
 	// If we just closed the current file, we need to set the current
 	// file as something else.
@@ -907,14 +902,14 @@
 void LDFile::forgetObject (LDObject* obj)
 {	int idx = obj->getIndex();
 	m_history.add (new DelHistory (idx, obj));
-	m_objects.erase (idx);
+	m_objects.removeAt (idx);
 	obj->setFile (null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool safeToCloseAll()
-{	for (LDFile * f : g_loadedFiles)
+{	for (LDFile* f : g_loadedFiles)
 		if (!f->safeToClose())
 			return false;
 
@@ -959,18 +954,18 @@
 {	List<LDFile*> filesUsed = getFilesUsed (LDFile::current());
 
 	// Anything that's explicitly opened must not be closed
-for (LDFile * file : g_loadedFiles)
+	for (LDFile* file : g_loadedFiles)
 		if (!file->implicit())
 			filesUsed << file;
 
 	// Remove duplicated entries
-	filesUsed.makeUnique();
+	removeDuplicates (filesUsed);
 
 	// Close all open files that aren't in filesUsed
-for (LDFile * file : g_loadedFiles)
+	for (LDFile* file : g_loadedFiles)
 	{	bool isused = false;
 
-	for (LDFile * usedFile : filesUsed)
+		for (LDFile* usedFile : filesUsed)
 		{	if (file == usedFile)
 			{	isused = true;
 				break;

mercurial