if (replace)
if (replace) {
ServiceImpl::RegisterResource(nsIRDFResource* aResource, PRBool replace){    NS_PRECONDITION(aResource != nsnull, "null ptr");    if (! aResource)        return NS_ERROR_NULL_POINTER;    nsresult rv;    const char* uri;    rv = aResource->GetValue(&uri);    if (NS_FAILED(rv)) return rv;    nsIRDFResource* prevRes =        NS_STATIC_CAST(nsIRDFResource*, PL_HashTableLookup(mResources, uri));    if (prevRes != nsnull) {        if (replace)            NS_RELEASE(prevRes);        else            return NS_ERROR_FAILURE;    // already registered    }    // This is a little trick to make storage more efficient. For    // the "key" in the table, we'll use the string value that's    // stored as a member variable of the nsIRDFResource object.    PL_HashTableAdd(mResources, uri, aResource);    // *We* don't AddRef() the resource: that way, the resource    // can be garbage collected when the last refcount goes    // away. The single addref that the CreateResource() call made    // will be owned by the callee.    return NS_OK;}