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 <waddlesplash@gmail.com>
This commit is contained in:
Augustin Cavalier 2019-02-14 19:20:34 -05:00 committed by waddlesplash
parent cc54b43e68
commit de48af7a58
10 changed files with 21 additions and 26 deletions

View File

@ -14,12 +14,6 @@
#include <Referenceable.h>
namespace BPrivate {
template <class key, class value> class SynchronizedHashMap;
class HashString;
}
class BUrlContext: public BReferenceable {
public:
BUrlContext();
@ -41,10 +35,11 @@ public:
uint16 GetProxyPort();
bool HasCertificateException(const BCertificate& certificate);
private:
class BHttpAuthenticationMap;
private:
BNetworkCookieJar fCookieJar;
typedef BPrivate::SynchronizedHashMap<BPrivate::HashString,
BHttpAuthentication*> BHttpAuthenticationMap;
BHttpAuthenticationMap* fAuthenticationMap;
typedef BObjectList<const BCertificate> BCertificateSet;
BCertificateSet fCertificates;

View File

@ -345,9 +345,9 @@ PRINT(("ShareVolume::PrepareToUnmount()\n"));
entry->GetDirectory()->GetID(), 0, entry->GetNode()->GetID(),
entry->GetName());
it.Remove();
_RemoveEntry(entry);
}
fEntries->Clear();
// get all IDs
int32 count = fNodes->Size();

View File

@ -11,13 +11,8 @@
#include "VolumeManager.h"
// VolumeSet
#ifdef B_HAIKU_64_BIT
struct VolumeManager::VolumeSet : HashSet<HashKey64<Volume*> > {
struct VolumeManager::VolumeSet : HashSet<HashKeyPointer<Volume*> > {
};
#else
struct VolumeManager::VolumeSet : HashSet<HashKey32<Volume*> > {
};
#endif
// NodeIDVolumeMap
struct VolumeManager::NodeIDVolumeMap : HashMap<HashKey64<vnode_id>, Volume*> {

View File

@ -682,7 +682,7 @@ SecurityContext::RemoveUser(User* user)
it.HasNext();) {
PermissionMap::Entry entry = it.Next();
if (entry.key.user == user)
it.Remove();
fPermissions->Remove(it);
}
// surrender our user reference

View File

@ -35,7 +35,7 @@ static const bigtime_t kNotificationRequestTimeout = 50000; // 50 ms
struct FileSystem::SelectSyncMap
: public SynchronizedHashMap<HashKeyPointer<selectsync*>, int32*> {
: public SynchronizedHashMap<HashKeyPointer<selectsync*>, int32*, Locker> {
};

View File

@ -8,6 +8,7 @@
#include <SupportDefs.h>
#include "AutoLocker.h"
#include "Locker.h"
#include "HashMap.h"
#include "String.h"
@ -40,7 +41,7 @@ public:
private:
friend class KernelDebug;
typedef SynchronizedHashMap<String, FileSystemInitializer*>
typedef SynchronizedHashMap<String, FileSystemInitializer*, Locker>
FileSystemMap;
typedef AutoLocker<UserlandFS::FileSystemMap> FileSystemLocker;

View File

@ -26,7 +26,7 @@
// NodeMap
class HaikuKernelVolume::NodeMap
: public SynchronizedHashMap<HashKey64<ino_t>, HaikuKernelNode*> {
: public SynchronizedHashMap<HashKey64<ino_t>, HaikuKernelNode*, Locker> {
};

View File

@ -84,7 +84,7 @@ BNetworkCookieJar::~BNetworkCookieJar()
PrivateHashMap::Iterator it = fCookieHashMap->GetIterator();
while (it.HasNext()) {
BNetworkCookieList* list = *it.NextValue();
BNetworkCookieList* list = it.Next().value;
it.Remove();
list->LockForWriting();
delete list;
@ -599,14 +599,14 @@ BNetworkCookieJar::Iterator::NextDomain()
fList->Unlock();
if (fCookieJar->fCookieHashMap->Lock()) {
fList = *fIterator->fCookieMapIterator.NextValue();
fList = fIterator->fCookieMapIterator.Next().value;
fList->LockForReading();
while (fList->CountItems() == 0
&& fIterator->fCookieMapIterator.HasNext()) {
// Empty list. Skip it
fList->Unlock();
fList = *fIterator->fCookieMapIterator.NextValue();
fList = fIterator->fCookieMapIterator.Next().value;
fList->LockForReading();
}
@ -688,14 +688,14 @@ BNetworkCookieJar::Iterator::_FindNext()
fLastList = fList;
if (fCookieJar->fCookieHashMap->Lock()) {
fList = *(fIterator->fCookieMapIterator.NextValue());
fList = (fIterator->fCookieMapIterator.Next().value);
fList->LockForReading();
while (fList->CountItems() == 0
&& fIterator->fCookieMapIterator.HasNext()) {
// Empty list. Skip it
fList->Unlock();
fList = *fIterator->fCookieMapIterator.NextValue();
fList = fIterator->fCookieMapIterator.Next().value;
fList->LockForReading();
}

View File

@ -16,6 +16,10 @@
#include <HashString.h>
class BUrlContext::BHttpAuthenticationMap : public
SynchronizedHashMap<BPrivate::HashString, BHttpAuthentication*> {};
BUrlContext::BUrlContext()
:
fCookieJar(),
@ -38,7 +42,7 @@ BUrlContext::~BUrlContext()
BHttpAuthenticationMap::Iterator iterator
= fAuthenticationMap->GetIterator();
while (iterator.HasNext())
delete *iterator.NextValue();
delete iterator.Next().value;
delete fAuthenticationMap;
}

View File

@ -174,7 +174,7 @@ BufferManager::Dump()
BufferInfoMap::Iterator iterator = fBufferInfoMap.GetIterator();
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, "
"size %ld, flags %#08" B_PRIx32 "\n", info.id, info.area,
info.offset, info.size, info.flags);