PL_HashTableAdd(mResources, aResource, head); } else { while (1) { if (head->mContent == aContent) { NS_ERROR("attempt to add same element twice"); return NS_ERROR_ILLEGAL_VALUE;
if (! head) { head = new (mPool) ContentListItem(aContent); if (! head) return NS_ERROR_OUT_OF_MEMORY;  PRUnichar* key = ToNewUnicode(aID); if (! key) return NS_ERROR_OUT_OF_MEMORY;  PL_HashTableAdd(mMap, key, head); } else { while (1) { if (head->mContent.get() == aContent) {        #ifdef PR_LOGGING if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) { nsresult rv;  nsCOMPtr<nsIAtom> tag; rv = aContent->GetTag(*getter_AddRefs(tag)); if (NS_FAILED(rv)) return rv;  nsAutoString tagname; rv = tag->ToString(tagname); if (NS_FAILED(rv)) return rv;  nsCAutoString tagnameC, aidC; tagnameC.AssignWithConversion(tagname); aidC.AssignWithConversion(id, aID.Length()); PR_LOG(gMapLog, PR_LOG_ALWAYS, ("xulelemap(%p) dup    %s[%p] <-- %s\n", this, (const char*) tagnameC, aContent, (const char*) aidC));
    Add(nsIRDFResource* aResource, nsIContent* aContent)    {        NS_PRECONDITION(mResources != nsnull, "not initialized");        if (! mResources)            return NS_ERROR_NOT_INITIALIZED;        ContentListItem* head =            (ContentListItem*) PL_HashTableLookup(mResources, aResource);        if (! head) {            head = new ContentListItem(aContent);            if (! head)                return NS_ERROR_OUT_OF_MEMORY;            PL_HashTableAdd(mResources, aResource, head);        }        else {            while (1) {                if (head->mContent == aContent) {                    NS_ERROR("attempt to add same element twice");                    return NS_ERROR_ILLEGAL_VALUE;                }                if (! head->mNext)                    break;                head = head->mNext;            }            head->mNext = new ContentListItem(aContent);            if (! head->mNext)                return NS_ERROR_OUT_OF_MEMORY;        }        return NS_OK;    }