Base: Clean up explicit uses of namespaces in places where they're not necessary.

This commit covers all of the common and base classes.
This commit is contained in:
Tim Wojtulewicz 2020-08-21 09:29:37 -07:00
parent 9f802b2a4d
commit fe0c22c789
240 changed files with 6823 additions and 6787 deletions

View file

@ -74,7 +74,7 @@ public:
char* key;
};
DictEntry(void* arg_key, int key_size = 0, zeek::detail::hash_t hash = 0, void* value = nullptr,
DictEntry(void* arg_key, int key_size = 0, hash_t hash = 0, void* value = nullptr,
int16_t d = TOO_FAR_TO_REACH, bool copy_key = false)
: distance(d), key_size(key_size), hash((uint32_t)hash), value(value)
{
@ -121,7 +121,7 @@ public:
const char* GetKey() const { return key_size <= 8 ? key_here : key; }
bool Equal(const char* arg_key, int arg_key_size, zeek::detail::hash_t arg_hash) const
bool Equal(const char* arg_key, int arg_key_size, hash_t arg_hash) const
{//only 40-bit hash comparison.
return ( 0 == ((hash ^ arg_hash) & HASH_MASK) )
&& key_size == arg_key_size && 0 == memcmp(GetKey(), arg_key, key_size);
@ -160,24 +160,24 @@ public:
// which takes a zeek::detail::HashKey, and the other which takes a raw key,
// its size, and its (unmodulated) hash.
//lookup may move the key to right place if in the old zone to speed up the next lookup.
void* Lookup(const zeek::detail::HashKey* key) const;
void* Lookup(const void* key, int key_size, zeek::detail::hash_t h) const;
void* Lookup(const detail::HashKey* key) const;
void* Lookup(const void* key, int key_size, detail::hash_t h) const;
// Returns previous value, or 0 if none.
void* Insert(zeek::detail::HashKey* key, void* val)
void* Insert(detail::HashKey* key, void* val)
{ return Insert(key->TakeKey(), key->Size(), key->Hash(), val, false); }
// If copy_key is true, then the key is copied, otherwise it's assumed
// that it's a heap pointer that now belongs to the Dictionary to
// manage as needed.
void* Insert(void* key, int key_size, zeek::detail::hash_t hash, void* val, bool copy_key);
void* Insert(void* key, int key_size, detail::hash_t hash, void* val, bool copy_key);
// Removes the given element. Returns a pointer to the element in
// case it needs to be deleted. Returns 0 if no such element exists.
// If dontdelete is true, the key's bytes will not be deleted.
void* Remove(const zeek::detail::HashKey* key)
void* Remove(const detail::HashKey* key)
{ return Remove(key->Key(), key->Size(), key->Hash()); }
void* Remove(const void* key, int key_size, zeek::detail::hash_t hash, bool dont_delete = false);
void* Remove(const void* key, int key_size, detail::hash_t hash, bool dont_delete = false);
// Number of entries.
int Length() const
@ -222,7 +222,7 @@ public:
// If return_hash is true, a HashKey for the entry is returned in h,
// which should be delete'd when no longer needed.
IterCookie* InitForIteration() const;
void* NextEntry(zeek::detail::HashKey*& h, IterCookie*& cookie, bool return_hash) const;
void* NextEntry(detail::HashKey*& h, IterCookie*& cookie, bool return_hash) const;
void StopIteration(IterCookie* cookie) const;
void SetDeleteFunc(dict_delete_func f) { delete_func = f; }
@ -262,10 +262,10 @@ private:
int ThresholdEntries() const;
// Used to improve the distribution of the original hash.
zeek::detail::hash_t FibHash(zeek::detail::hash_t h) const;
detail::hash_t FibHash(detail::hash_t h) const;
// Maps a hash to the appropriate n-bit table bucket.
int BucketByHash(zeek::detail::hash_t h, int bit) const;
int BucketByHash(detail::hash_t h, int bit) const;
// Given a position of a non-empty item in the table, find the related bucket.
int BucketByPosition(int position) const;
@ -297,14 +297,14 @@ private:
//Iteration
IterCookie* InitForIterationNonConst();
void* NextEntryNonConst(zeek::detail::HashKey*& h, IterCookie*& cookie, bool return_hash);
void* NextEntryNonConst(detail::HashKey*& h, IterCookie*& cookie, bool return_hash);
void StopIterationNonConst(IterCookie* cookie);
//Lookup
int LinearLookupIndex(const void* key, int key_size, zeek::detail::hash_t hash) const;
int LookupIndex(const void* key, int key_size, zeek::detail::hash_t hash, int* insert_position = nullptr,
int LinearLookupIndex(const void* key, int key_size, detail::hash_t hash) const;
int LookupIndex(const void* key, int key_size, detail::hash_t hash, int* insert_position = nullptr,
int* insert_distance = nullptr);
int LookupIndex(const void* key, int key_size, zeek::detail::hash_t hash, int begin, int end,
int LookupIndex(const void* key, int key_size, detail::hash_t hash, int begin, int end,
int* insert_position = nullptr, int* insert_distance = nullptr);
/// Insert entry, Adjust cookies when necessary.
@ -375,17 +375,17 @@ public:
Dictionary(ordering, initial_size) {}
T* Lookup(const char* key) const
{
zeek::detail::HashKey h(key);
detail::HashKey h(key);
return (T*) Dictionary::Lookup(&h);
}
T* Lookup(const zeek::detail::HashKey* key) const
T* Lookup(const detail::HashKey* key) const
{ return (T*) Dictionary::Lookup(key); }
T* Insert(const char* key, T* val)
{
zeek::detail::HashKey h(key);
detail::HashKey h(key);
return (T*) Dictionary::Insert(&h, (void*) val);
}
T* Insert(zeek::detail::HashKey* key, T* val)
T* Insert(detail::HashKey* key, T* val)
{ return (T*) Dictionary::Insert(key, (void*) val); }
T* NthEntry(int n) const
{ return (T*) Dictionary::NthEntry(n); }
@ -396,14 +396,14 @@ public:
}
T* NextEntry(IterCookie*& cookie) const
{
zeek::detail::HashKey* h;
detail::HashKey* h;
return (T*) Dictionary::NextEntry(h, cookie, false);
}
T* NextEntry(zeek::detail::HashKey*& h, IterCookie*& cookie) const
T* NextEntry(detail::HashKey*& h, IterCookie*& cookie) const
{ return (T*) Dictionary::NextEntry(h, cookie, true); }
T* RemoveEntry(const zeek::detail::HashKey* key)
T* RemoveEntry(const detail::HashKey* key)
{ return (T*) Remove(key->Key(), key->Size(), key->Hash()); }
T* RemoveEntry(const zeek::detail::HashKey& key)
T* RemoveEntry(const detail::HashKey& key)
{ return (T*) Remove(key.Key(), key.Size(), key.Hash()); }
};