Bug 1163331 - Remove PL_NewDHashTable() and PL_DHashTableDestroy() from /mailnews/ r=rkent

This commit is contained in:
Philip Chee 2015-05-10 13:19:20 +01:00
Родитель 6b2158285f
Коммит d2e487018e
1 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -488,7 +488,7 @@ nsresult nsMsgDatabase::AddHdrToCache(nsIMsgDBHdr *hdr, nsMsgKey key) // do we w
if (m_bCacheHeaders)
{
if (!m_cachedHeaders)
m_cachedHeaders = PL_NewDHashTable(&gMsgDBHashTableOps, sizeof(struct MsgHdrHashElement), m_cacheSize);
m_cachedHeaders = new PLDHashTable(&gMsgDBHashTableOps, sizeof(struct MsgHdrHashElement), m_cacheSize);
if (m_cachedHeaders)
{
if (key == nsMsgKey_None)
@ -673,7 +673,8 @@ nsresult nsMsgDatabase::ClearHdrCache(bool reInit)
}
else
{
PL_DHashTableDestroy(saveCachedHeaders);
delete saveCachedHeaders;
saveCachedHeaders = nullptr;
}
}
return NS_OK;
@ -775,7 +776,7 @@ nsresult nsMsgDatabase::AddHdrToUseCache(nsIMsgDBHdr *hdr, nsMsgKey key)
mdb_count numHdrs = MSG_HASH_SIZE;
if (m_mdbAllMsgHeadersTable)
m_mdbAllMsgHeadersTable->GetCount(GetEnv(), &numHdrs);
m_headersInUse = PL_NewDHashTable(&gMsgDBHashTableOps, sizeof(struct MsgHdrHashElement), std::max((mdb_count)MSG_HASH_SIZE, numHdrs));
m_headersInUse = new PLDHashTable(&gMsgDBHashTableOps, sizeof(struct MsgHdrHashElement), std::max((mdb_count)MSG_HASH_SIZE, numHdrs));
}
if (m_headersInUse)
{
@ -804,7 +805,7 @@ nsresult nsMsgDatabase::ClearUseHdrCache()
// clear mdb row pointers of any headers still in use, because the
// underlying db is going away.
PL_DHashTableEnumerate(m_headersInUse, ClearHeaderEnumerator, nullptr);
PL_DHashTableDestroy(m_headersInUse);
delete m_headersInUse;
m_headersInUse = nullptr;
}
return NS_OK;
@ -1148,7 +1149,7 @@ nsMsgDatabase::~nsMsgDatabase()
if (m_msgReferences)
{
PL_DHashTableDestroy(m_msgReferences);
delete m_msgReferences;
m_msgReferences = nullptr;
}
@ -4229,10 +4230,10 @@ nsresult nsMsgDatabase::InitRefHash()
{
// Delete an existing table just in case
if (m_msgReferences)
PL_DHashTableDestroy(m_msgReferences);
delete m_msgReferences;
// Create new table
m_msgReferences = PL_NewDHashTable(&gRefHashTableOps, sizeof(struct RefHashElement), MSG_HASH_SIZE);
m_msgReferences = new PLDHashTable(&gRefHashTableOps, sizeof(struct RefHashElement), MSG_HASH_SIZE);
if (!m_msgReferences)
return NS_ERROR_OUT_OF_MEMORY;