static int32_t* GetCOMPtrCount(void* aPtr) { PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr); if (hep && *hep) { return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->COMPtrCount); } else { return nullptr; } }
static intptr_t GetSerialNumber(void* aPtr, bool aCreate) { PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr); if (hep && *hep) { return reinterpret_cast<serialNumberRecord*>((*hep)->value)->serialNumber; } else if (aCreate) { serialNumberRecord *record = PR_NEW(serialNumberRecord); record->serialNumber = ++gNextSerialNumber; record->refCount = 0; record->COMPtrCount = 0; PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr, reinterpret_cast<void*>(record)); return gNextSerialNumber; } else { return 0; } }
PLHashNumber nsNodeInfoManager::GetNodeInfoInnerHashValue(const void *key) { NS_ASSERTION(key, "Null key passed to nsNodeInfo::GetHashValue!"); const nsINodeInfo::nsNodeInfoInner *node = reinterpret_cast<const nsINodeInfo::nsNodeInfoInner *>(key); // Is this an acceptable hash value? return (PLHashNumber(NS_PTR_TO_INT32(node->mName)) & 0xffff) >> 8; }
static PLHashNumber HashNumber(const void* aKey) { return PLHashNumber(NS_PTR_TO_INT32(aKey)); }
// We really should have a Unity PL Hash function... static PR_CALLBACK PLHashNumber unity(const void *key) { return PLHashNumber(NS_PTR_TO_INT32(key)); }