if (*hep) {
if (PL_DHASH_ENTRY_IS_BUSY(hdr)) {
RDFServiceImpl::RegisterResource(nsIRDFResource* aResource, PRBool aReplace){    NS_PRECONDITION(aResource != nsnull, "null ptr");    if (! aResource)        return NS_ERROR_NULL_POINTER;    nsresult rv;#ifdef REUSE_RESOURCE_URI_AS_KEY    const char* uri;    rv = aResource->GetValueConst(&uri);#else    nsXPIDLCString uri;    rv = aResource->GetValue(getter_Copies(uri));#endif    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get URI from resource");    if (NS_FAILED(rv)) return rv;    NS_ASSERTION(uri != nsnull, "resource has no URI");    if (! uri)        return NS_ERROR_NULL_POINTER;    PLHashNumber keyhash = (*mResources->keyHash)(uri);    PLHashEntry** hep = PL_HashTableRawLookup(mResources, keyhash, uri);    if (*hep) {        if (!aReplace) {            NS_WARNING("resource already registered, and replace not specified");            return NS_ERROR_FAILURE;    // already registered        }        // N.B., we do _not_ release the original resource because we        // only ever held a weak reference to it. We simply replace        // it.        PR_LOG(gLog, PR_LOG_DEBUG,               ("rdfserv   replace-resource [%p] <-- [%p] %s",                (*hep)->value, aResource, (const char*) uri));#ifdef REUSE_RESOURCE_URI_AS_KEY        (*hep)->key   = uri;#endif        (*hep)->value = aResource;    }    else {#ifdef REUSE_RESOURCE_URI_AS_KEY        PL_HashTableRawAdd(mResources, hep, keyhash, uri, aResource);#else        const char* key = PL_strdup(uri);        if (! key)            return NS_ERROR_OUT_OF_MEMORY;        PL_HashTableRawAdd(mResources, hep, keyhash, key, aResource);#endif        PR_LOG(gLog, PR_LOG_DEBUG,               ("rdfserv   register-resource [%p] %s",                aResource, (const char*) uri));        // N.B., we only hold a weak reference to the resource: that        // way, the resource can be destroyed when the last refcount        // goes away. The single addref that the CreateResource() call        // made will be owned by the callee.    }    return NS_OK;}