Part of fix for 18315 -- allow nsSupportsHashTable to contain null entries, which meant changing NS_{ADDREF,RELEASE} to NS_IF_{ADDREF,RELEASE} in a bunch of places. r=pavlov.

This commit is contained in:
sfraser@netscape.com
1999-11-11 20:41:54 +00:00
parent d901c78434
commit a1067e7801

View File

@@ -384,7 +384,7 @@ static PR_CALLBACK PRBool
_ReleaseElement(nsHashKey *aKey, void *aData, void* closure)
{
nsISupports* element = NS_STATIC_CAST(nsISupports*, aData);
NS_RELEASE(element);
NS_IF_RELEASE(element);
return PR_TRUE;
}
@@ -397,7 +397,7 @@ void*
nsSupportsHashtable::Put(nsHashKey *aKey, void *aData)
{
nsISupports* element = NS_STATIC_CAST(nsISupports*, aData);
NS_ADDREF(element);
NS_IF_ADDREF(element);
return nsHashtable::Put(aKey, aData);
}
@@ -408,7 +408,7 @@ nsSupportsHashtable::Get(nsHashKey *aKey)
if (!data)
return nsnull;
nsISupports* element = NS_STATIC_CAST(nsISupports*, data);
NS_ADDREF(element);
NS_IF_ADDREF(element);
return data;
}
@@ -419,7 +419,7 @@ nsSupportsHashtable::Remove(nsHashKey *aKey)
if (!data)
return nsnull;
nsISupports* element = NS_STATIC_CAST(nsISupports*, data);
NS_RELEASE(element);
NS_IF_RELEASE(element);
return data;
}
@@ -428,7 +428,7 @@ _hashEnumerateCopy(PLHashEntry *he, PRIntn i, void *arg)
{
nsHashtable *newHashtable = (nsHashtable *)arg;
nsISupports* element = NS_STATIC_CAST(nsISupports*, he->value);
NS_ADDREF(element);
NS_IF_ADDREF(element);
newHashtable->Put((nsHashKey*)he->key, he->value);
return HT_ENUMERATE_NEXT;
}