Adapt all consumers of HashSet and HashMap to the slightly-different APIs.

No functional changes intended. Tested and verified as working.

Change-Id: Iaa67c2e5f0d9aff433ac7348e63e901a6a80e589
Reviewed-on: https://review.haiku-os.org/c/1043
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2019-02-15 00:34:36 +00:00
committed by waddlesplash
parent cc54b43e68
commit de48af7a58
10 changed files with 21 additions and 26 deletions
+3 -8
View File
@@ -14,12 +14,6 @@
#include <Referenceable.h> #include <Referenceable.h>
namespace BPrivate {
template <class key, class value> class SynchronizedHashMap;
class HashString;
}
class BUrlContext: public BReferenceable { class BUrlContext: public BReferenceable {
public: public:
BUrlContext(); BUrlContext();
@@ -41,10 +35,11 @@ public:
uint16 GetProxyPort(); uint16 GetProxyPort();
bool HasCertificateException(const BCertificate& certificate); bool HasCertificateException(const BCertificate& certificate);
private:
class BHttpAuthenticationMap;
private: private:
BNetworkCookieJar fCookieJar; BNetworkCookieJar fCookieJar;
typedef BPrivate::SynchronizedHashMap<BPrivate::HashString,
BHttpAuthentication*> BHttpAuthenticationMap;
BHttpAuthenticationMap* fAuthenticationMap; BHttpAuthenticationMap* fAuthenticationMap;
typedef BObjectList<const BCertificate> BCertificateSet; typedef BObjectList<const BCertificate> BCertificateSet;
BCertificateSet fCertificates; BCertificateSet fCertificates;
@@ -345,9 +345,9 @@ PRINT(("ShareVolume::PrepareToUnmount()\n"));
entry->GetDirectory()->GetID(), 0, entry->GetNode()->GetID(), entry->GetDirectory()->GetID(), 0, entry->GetNode()->GetID(),
entry->GetName()); entry->GetName());
it.Remove();
_RemoveEntry(entry); _RemoveEntry(entry);
} }
fEntries->Clear();
// get all IDs // get all IDs
int32 count = fNodes->Size(); int32 count = fNodes->Size();
@@ -11,13 +11,8 @@
#include "VolumeManager.h" #include "VolumeManager.h"
// VolumeSet // VolumeSet
#ifdef B_HAIKU_64_BIT struct VolumeManager::VolumeSet : HashSet<HashKeyPointer<Volume*> > {
struct VolumeManager::VolumeSet : HashSet<HashKey64<Volume*> > {
}; };
#else
struct VolumeManager::VolumeSet : HashSet<HashKey32<Volume*> > {
};
#endif
// NodeIDVolumeMap // NodeIDVolumeMap
struct VolumeManager::NodeIDVolumeMap : HashMap<HashKey64<vnode_id>, Volume*> { struct VolumeManager::NodeIDVolumeMap : HashMap<HashKey64<vnode_id>, Volume*> {
@@ -682,7 +682,7 @@ SecurityContext::RemoveUser(User* user)
it.HasNext();) { it.HasNext();) {
PermissionMap::Entry entry = it.Next(); PermissionMap::Entry entry = it.Next();
if (entry.key.user == user) if (entry.key.user == user)
it.Remove(); fPermissions->Remove(it);
} }
// surrender our user reference // surrender our user reference
@@ -35,7 +35,7 @@ static const bigtime_t kNotificationRequestTimeout = 50000; // 50 ms
struct FileSystem::SelectSyncMap struct FileSystem::SelectSyncMap
: public SynchronizedHashMap<HashKeyPointer<selectsync*>, int32*> { : public SynchronizedHashMap<HashKeyPointer<selectsync*>, int32*, Locker> {
}; };
@@ -8,6 +8,7 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include "AutoLocker.h" #include "AutoLocker.h"
#include "Locker.h"
#include "HashMap.h" #include "HashMap.h"
#include "String.h" #include "String.h"
@@ -40,7 +41,7 @@ public:
private: private:
friend class KernelDebug; friend class KernelDebug;
typedef SynchronizedHashMap<String, FileSystemInitializer*> typedef SynchronizedHashMap<String, FileSystemInitializer*, Locker>
FileSystemMap; FileSystemMap;
typedef AutoLocker<UserlandFS::FileSystemMap> FileSystemLocker; typedef AutoLocker<UserlandFS::FileSystemMap> FileSystemLocker;
@@ -26,7 +26,7 @@
// NodeMap // NodeMap
class HaikuKernelVolume::NodeMap class HaikuKernelVolume::NodeMap
: public SynchronizedHashMap<HashKey64<ino_t>, HaikuKernelNode*> { : public SynchronizedHashMap<HashKey64<ino_t>, HaikuKernelNode*, Locker> {
}; };
@@ -84,7 +84,7 @@ BNetworkCookieJar::~BNetworkCookieJar()
PrivateHashMap::Iterator it = fCookieHashMap->GetIterator(); PrivateHashMap::Iterator it = fCookieHashMap->GetIterator();
while (it.HasNext()) { while (it.HasNext()) {
BNetworkCookieList* list = *it.NextValue(); BNetworkCookieList* list = it.Next().value;
it.Remove(); it.Remove();
list->LockForWriting(); list->LockForWriting();
delete list; delete list;
@@ -599,14 +599,14 @@ BNetworkCookieJar::Iterator::NextDomain()
fList->Unlock(); fList->Unlock();
if (fCookieJar->fCookieHashMap->Lock()) { if (fCookieJar->fCookieHashMap->Lock()) {
fList = *fIterator->fCookieMapIterator.NextValue(); fList = fIterator->fCookieMapIterator.Next().value;
fList->LockForReading(); fList->LockForReading();
while (fList->CountItems() == 0 while (fList->CountItems() == 0
&& fIterator->fCookieMapIterator.HasNext()) { && fIterator->fCookieMapIterator.HasNext()) {
// Empty list. Skip it // Empty list. Skip it
fList->Unlock(); fList->Unlock();
fList = *fIterator->fCookieMapIterator.NextValue(); fList = fIterator->fCookieMapIterator.Next().value;
fList->LockForReading(); fList->LockForReading();
} }
@@ -688,14 +688,14 @@ BNetworkCookieJar::Iterator::_FindNext()
fLastList = fList; fLastList = fList;
if (fCookieJar->fCookieHashMap->Lock()) { if (fCookieJar->fCookieHashMap->Lock()) {
fList = *(fIterator->fCookieMapIterator.NextValue()); fList = (fIterator->fCookieMapIterator.Next().value);
fList->LockForReading(); fList->LockForReading();
while (fList->CountItems() == 0 while (fList->CountItems() == 0
&& fIterator->fCookieMapIterator.HasNext()) { && fIterator->fCookieMapIterator.HasNext()) {
// Empty list. Skip it // Empty list. Skip it
fList->Unlock(); fList->Unlock();
fList = *fIterator->fCookieMapIterator.NextValue(); fList = fIterator->fCookieMapIterator.Next().value;
fList->LockForReading(); fList->LockForReading();
} }
+5 -1
View File
@@ -16,6 +16,10 @@
#include <HashString.h> #include <HashString.h>
class BUrlContext::BHttpAuthenticationMap : public
SynchronizedHashMap<BPrivate::HashString, BHttpAuthentication*> {};
BUrlContext::BUrlContext() BUrlContext::BUrlContext()
: :
fCookieJar(), fCookieJar(),
@@ -38,7 +42,7 @@ BUrlContext::~BUrlContext()
BHttpAuthenticationMap::Iterator iterator BHttpAuthenticationMap::Iterator iterator
= fAuthenticationMap->GetIterator(); = fAuthenticationMap->GetIterator();
while (iterator.HasNext()) while (iterator.HasNext())
delete *iterator.NextValue(); delete iterator.Next().value;
delete fAuthenticationMap; delete fAuthenticationMap;
} }
+1 -1
View File
@@ -174,7 +174,7 @@ BufferManager::Dump()
BufferInfoMap::Iterator iterator = fBufferInfoMap.GetIterator(); BufferInfoMap::Iterator iterator = fBufferInfoMap.GetIterator();
while (iterator.HasNext()) { while (iterator.HasNext()) {
buffer_info& info = *iterator.NextValue(); buffer_info info = iterator.Next().value;
printf(" buffer-id %" B_PRId32 ", area-id %" B_PRId32 ", offset %ld, " printf(" buffer-id %" B_PRId32 ", area-id %" B_PRId32 ", offset %ld, "
"size %ld, flags %#08" B_PRIx32 "\n", info.id, info.area, "size %ld, flags %#08" B_PRIx32 "\n", info.id, info.area,
info.offset, info.size, info.flags); info.offset, info.size, info.flags);