From 360c503e4e5c06b95e15cca7b550574bcb2fdc70 Mon Sep 17 00:00:00 2001 From: "bruce%cybersight.com" Date: Sat, 4 Sep 1999 13:42:15 +0000 Subject: [PATCH] Use nsAllocator instead of new[] and nsCRT::free() instead of delete[] for char* data. --- rdf/base/src/nsInMemoryDataSource.cpp | 2 +- rdf/base/src/nsRDFContentSink.cpp | 4 ++-- rdf/base/src/nsRDFService.cpp | 12 ++++++------ rdf/base/src/nsRDFXMLDataSource.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rdf/base/src/nsInMemoryDataSource.cpp b/rdf/base/src/nsInMemoryDataSource.cpp index 666edafe3bf..e606ab5de2f 100644 --- a/rdf/base/src/nsInMemoryDataSource.cpp +++ b/rdf/base/src/nsInMemoryDataSource.cpp @@ -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, diff --git a/rdf/base/src/nsRDFContentSink.cpp b/rdf/base/src/nsRDFContentSink.cpp index a4d0516613f..404ed92ff01 100644 --- a/rdf/base/src/nsRDFContentSink.cpp +++ b/rdf/base/src/nsRDFContentSink.cpp @@ -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 } diff --git a/rdf/base/src/nsRDFService.cpp b/rdf/base/src/nsRDFService.cpp index 6cfb27c2cfa..5bddcadd7d8 100644 --- a/rdf/base/src/nsRDFService.cpp +++ b/rdf/base/src/nsRDFService.cpp @@ -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; diff --git a/rdf/base/src/nsRDFXMLDataSource.cpp b/rdf/base/src/nsRDFXMLDataSource.cpp index a8e9be62fe7..dbda6f48608 100644 --- a/rdf/base/src/nsRDFXMLDataSource.cpp +++ b/rdf/base/src/nsRDFXMLDataSource.cpp @@ -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; }