RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, PRBool replace)
RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, PRBool aReplace)
RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, PRBool replace){    NS_PRECONDITION(aDataSource != nsnull, "null ptr");    if (! aDataSource)        return NS_ERROR_NULL_POINTER;    nsresult rv;    nsXPIDLCString uri;    rv = aDataSource->GetURI(getter_Copies(uri));    if (NS_FAILED(rv)) return rv;    PLHashEntry** hep =        PL_HashTableRawLookup(mNamedDataSources, (*mNamedDataSources->keyHash)(uri), uri);    if (*hep) {        if (! replace)            return NS_ERROR_FAILURE; // already registered        // N.B., we only hold a weak reference to the datasource, so        // just replace the old with the new and don't touch any        // refcounts.        PR_LOG(gLog, PR_LOG_ALWAYS,               ("rdfserv    replace-datasource [%p] <-- [%p] %s",                (*hep)->value, aDataSource, (const char*) uri));        (*hep)->value = aDataSource;    }    else {        const char* key = PL_strdup(uri);        if (! key)            return NS_ERROR_OUT_OF_MEMORY;        PL_HashTableAdd(mNamedDataSources, key, aDataSource);        PR_LOG(gLog, PR_LOG_ALWAYS,               ("rdfserv   register-datasource [%p] %s",                aDataSource, (const char*) uri));        // N.B., we only hold a weak reference to the datasource, so don't        // addref.    }    return NS_OK;}