Changed to use operator new[] instead of PL_strdup(). (Thanks, Brad!)

This commit is contained in:
waterson%netscape.com 1999-03-18 20:47:03 +00:00
Родитель 0338e56e86
Коммит d1f752c7d8
1 изменённых файлов: 8 добавлений и 3 удалений

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

@ -86,12 +86,17 @@ nsRDFResource::QueryInterface(REFNSIID iid, void** result)
// nsIRDFNode methods:
NS_IMETHODIMP
nsRDFResource::Init(const char* uri)
nsRDFResource::Init(const char* aURI)
{
mURI = nsCRT::strdup(uri);
if (mURI == nsnull)
NS_PRECONDITION(aURI != nsnull, "null ptr");
if (! aURI)
return NS_ERROR_NULL_POINTER;
if (! (mURI = new char[PL_strlen(aURI) + 1]))
return NS_ERROR_OUT_OF_MEMORY;
PL_strcpy(mURI, aURI);
// don't replace an existing resource with the same URI automatically
return gRDFService->RegisterResource(this, PR_TRUE);
}