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:
2026-06-25 11:33:29 +02:00
parent 00c8d9b843
commit 2849183f1f
4 changed files with 12 additions and 10 deletions
+3 -3
View File
@@ -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