Switch HashTable to shared_ptr and add missing returns
Use std::shared_ptr<Track> in HashTable to avoid raw pointer ownership issues. Also add missing return statements in Database ID lookup helpers.
This commit is contained in:
@@ -53,8 +53,8 @@ class HashTable {
|
||||
HashTable ( HashTable && ) noexcept = default;
|
||||
HashTable &operator= ( HashTable && ) noexcept = default;
|
||||
|
||||
void ht_insert ( const std::string &key, Track* t );
|
||||
Track* ht_lookup ( const std::string &key ) const;
|
||||
void ht_insert ( const std::string &key, std::shared_ptr<Track> t );
|
||||
std::shared_ptr<Track> ht_lookup ( const std::string &key ) const;
|
||||
bool ht_delete ( const std::string &key );
|
||||
|
||||
std::vector<std::string> listAll () const;
|
||||
@@ -72,7 +72,7 @@ class HashTable {
|
||||
struct Entry {
|
||||
std::string key;
|
||||
uint64_t hash = 0;
|
||||
Track* track;
|
||||
std::shared_ptr<Track> track;
|
||||
};
|
||||
|
||||
// helpers
|
||||
|
||||
Reference in New Issue
Block a user