nsrefcnt refcnt = resource->AddRef(); resource->Release();
resource->AddRef(); nsrefcnt refcnt = resource->Release();
rdf_CreateAnonymousResource(const nsString& aContextURI, nsIRDFResource** aResult){static PRUint32 gCounter = 0;    nsresult rv;    rv = rdf_EnsureRDFService();    if (NS_FAILED(rv)) return rv;    if (! gCounter) {        // Start it at a semi-unique value, just to minimize the        // chance that we get into a situation where        //        // 1. An anonymous resource gets serialized out in a graph        // 2. Reboot        // 3. The same anonymous resource gets requested, and refers        //    to something completely different.        // 4. The serialization is read back in.        LL_L2UI(gCounter, PR_Now());    }    do {        nsAutoString s(aContextURI);        s.Append("#$");        s.Append(++gCounter, 16);        nsIRDFResource* resource;        if (NS_FAILED(rv = gRDFService->GetUnicodeResource(s.GetUnicode(), &resource)))            return rv;        // XXX an ugly but effective way to make sure that this        // resource is really unique in the world.        nsrefcnt refcnt = resource->AddRef();        resource->Release();        if (refcnt == 2) {            *aResult = resource;            break;        }    } while (1);    return NS_OK;}