Use nsAllocator instead of new[] and nsCRT::free() instead of delete[] for char* data.

This commit is contained in:
bruce%cybersight.com 1999-09-04 13:42:15 +00:00
Родитель 8f0d1e2b74
Коммит 360c503e4e
4 изменённых файлов: 11 добавлений и 11 удалений

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

@ -720,7 +720,7 @@ InMemoryDataSource::LogOperation(const char* aOperation,
PR_LOG(gLog, PR_LOG_ALWAYS,
(" -->(\"%s\")\n", valueCStr));
delete[] valueCStr;
nsCRT::free(valueCStr);
}
else {
PR_LOG(gLog, PR_LOG_ALWAYS,

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

@ -543,7 +543,7 @@ RDFContentSinkImpl::CloseContainer(const nsIParserNode& aNode)
("rdfxml: extra close tag '%s' at line %d",
tagCStr, aNode.GetSourceLineNumber()));
delete[] tagCStr;
nsCRT::free(tagCStr);
}
#endif
@ -906,7 +906,7 @@ RDFContentSinkImpl::GetNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID)
("rdfxml: undeclared namespace prefix '%s'",
prefixCStr));
delete[] prefixCStr;
nsCRT::free(prefixCStr);
}
#endif
}

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

@ -542,7 +542,7 @@ ServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
char buf[128];
char* progID = buf;
if (len >= PRInt32(sizeof buf))
progID = new char[len + 1];
progID = (char *)nsAllocator::Alloc(len + 1);
if (progID == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
@ -555,7 +555,7 @@ ServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
rv = nsComponentManager::ProgIDToCLSID(progID, &cid);
if (progID != buf)
delete[] progID;
nsCRT::free(progID);
if (NS_SUCCEEDED(rv)) {
rv = nsComponentManager::FindFactory(cid, getter_AddRefs(factory));
@ -599,7 +599,7 @@ ServiceImpl::GetUnicodeResource(const PRUnichar* aURI, nsIRDFResource** aResourc
PRUint32 len = nsCRT::strlen(aURI);
if (len >= sizeof(buf)) {
uri = new char[len + 1];
uri = (char *)nsAllocator::Alloc(len + 1);
if (! uri) return NS_ERROR_OUT_OF_MEMORY;
}
@ -616,7 +616,7 @@ ServiceImpl::GetUnicodeResource(const PRUnichar* aURI, nsIRDFResource** aResourc
nsresult rv = GetResource(uri, aResource);
if (uri != buf)
delete[] uri;
nsCRT::free(uri);
return rv;
}
@ -915,7 +915,7 @@ ServiceImpl::GetDataSource(const char* uri, nsIRDFDataSource** aDataSource)
char buf[64];
char* progID = buf, *p;
if (progIDStr.Length() >= PRInt32(sizeof buf))
progID = new char[progIDStr.Length() + 1];
progID = (char *)nsAllocator::Alloc(progIDStr.Length() + 1);
if (progID == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
@ -931,7 +931,7 @@ ServiceImpl::GetDataSource(const char* uri, nsIRDFDataSource** aDataSource)
rv = nsServiceManager::GetService(progID, kISupportsIID, getter_AddRefs(isupports), nsnull);
if (progID != buf)
delete[] progID;
nsCRT::free(progID);
if (NS_FAILED(rv)) return rv;

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

@ -1052,12 +1052,12 @@ rdf_BlockingWrite(nsIOutputStream* stream, const nsString& s)
char* p = buf;
if (s.Length() >= PRInt32(sizeof buf))
p = new char[s.Length() + 1];
p = (char *)nsAllocator::Alloc(s.Length() + 1);
nsresult rv = rdf_BlockingWrite(stream, s.ToCString(p, s.Length() + 1), s.Length());
if (p != buf)
delete[](p);
nsCRT::free(p);
return rv;
}