fixes 122892. Optimization Clone of nsLocalFile. Instead of reiniting object, we use default c++ copy construction. r=ccarlen@netscape.com, sr=dveditz@netscape.com

This commit is contained in:
dougt%netscape.com 2002-02-02 01:25:57 +00:00
Родитель 9054da7961
Коммит 97c85e367d
2 изменённых файлов: 17 добавлений и 18 удалений

Просмотреть файл

@ -240,17 +240,16 @@ nsLocalFile::Clone(nsIFile **file)
{
CHECK_mPath();
NS_ENSURE_ARG(file);
nsCOMPtr<nsILocalFile> localFile = new nsLocalFile();
if (!localFile)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = localFile->InitWithPath(mPath);
if (NS_FAILED(rv))
return rv;
*file = nsnull;
// Just copy-construct ourselves
nsCOMPtr<nsILocalFile> localFile = new nsLocalFile(*this);
if (localFile == NULL)
return NS_ERROR_OUT_OF_MEMORY;
*file = localFile;
NS_ADDREF(*file);
return NS_OK;
}

Просмотреть файл

@ -650,18 +650,18 @@ nsLocalFile::ResolveAndStat(PRBool resolveTerminal)
NS_IMETHODIMP
nsLocalFile::Clone(nsIFile **file)
{
nsresult rv;
NS_ENSURE_ARG(file);
*file = nsnull;
nsCOMPtr<nsILocalFile> localFile;
// Just copy-construct ourselves
nsCOMPtr<nsILocalFile> localFile = new nsLocalFile(*this);
if (localFile == NULL)
return NS_ERROR_OUT_OF_MEMORY;
rv = NS_NewLocalFile(mWorkingPath.get(), mFollowSymlinks, getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv) && localFile)
{
return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)file);
}
return rv;
*file = localFile;
NS_ADDREF(*file);
return NS_OK;
}
NS_IMETHODIMP