[Scummvm-cvs-logs] CVS: scummvm/backends/fs/posix posix-fs.cpp,1.19,1.20

Max Horn fingolfin at users.sourceforge.net
Sun Nov 21 05:26:24 CET 2004


Update of /cvsroot/scummvm/scummvm/backends/fs/posix
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12610/posix

Modified Files:
	posix-fs.cpp 
Log Message:
Since we do ref counting on the nodes now, we can re-use the root nodes now

Index: posix-fs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/posix/posix-fs.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- posix-fs.cpp	20 Nov 2004 21:35:48 -0000	1.19
+++ posix-fs.cpp	21 Nov 2004 13:18:07 -0000	1.20
@@ -185,22 +185,19 @@
 }
 
 AbstractFilesystemNode *POSIXFilesystemNode::parent() const {
+	if (_path == "/")
+		return 0;
+
 	POSIXFilesystemNode *p = new POSIXFilesystemNode();
+	const char *start = _path.c_str();
+	const char *end = lastPathComponent(_path);
 
-	// Root node is its own parent. Still we can't just return this
-	// as the GUI code will call delete on the old node.
-	if (_path != "/") {
-		const char *start = _path.c_str();
-		const char *end = lastPathComponent(_path);
+	p->_path = String(start, end - start);
+	p->_displayName = lastPathComponent(p->_path);
 
-		p->_path = String(start, end - start);
-		p->_displayName = lastPathComponent(p->_path);
-	} else {
-		p->_path = _path;
-		p->_displayName = _displayName;
-	}
 	p->_isValid = true;
 	p->_isDirectory = true;
+
 	return p;
 }
 





More information about the Scummvm-git-logs mailing list