diff options
author | Chris Robinson <[email protected]> | 2018-11-18 21:18:19 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-18 21:18:19 -0800 |
commit | e23796aabe21a065b3fde34e8023a60a4bcb7dc5 (patch) | |
tree | 464e2d5d9947992e9cfa1024f719f62cc5643091 /Alc/hrtf.cpp | |
parent | 140c139852de0bde537de0314e30239832f309f1 (diff) |
Use a standard string for the enumerated HRTF names
Diffstat (limited to 'Alc/hrtf.cpp')
-rw-r--r-- | Alc/hrtf.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/Alc/hrtf.cpp b/Alc/hrtf.cpp index 1305c347..89b80074 100644 --- a/Alc/hrtf.cpp +++ b/Alc/hrtf.cpp @@ -1007,10 +1007,10 @@ void AddFileEntry(al::vector<EnumeratedHrtf> &list, const std::string &filename) newname += " #"; newname += std::to_string(++count); } - list.push_back(EnumeratedHrtf{alstrdup(newname.c_str()), loaded_entry}); + list.emplace_back(EnumeratedHrtf{newname, loaded_entry}); const EnumeratedHrtf &entry = list.back(); - TRACE("Adding file entry \"%s\"\n", entry.name); + TRACE("Adding file entry \"%s\"\n", entry.name.c_str()); } /* Unfortunate that we have to duplicate AddFileEntry to take a memory buffer @@ -1066,10 +1066,10 @@ void AddBuiltInEntry(al::vector<EnumeratedHrtf> &list, const std::string &filena newname += " #"; newname += std::to_string(++count); } - list.push_back(EnumeratedHrtf{alstrdup(newname.c_str()), loaded_entry}); + list.emplace_back(EnumeratedHrtf{newname, loaded_entry}); const EnumeratedHrtf &entry = list.back(); - TRACE("Adding built-in entry \"%s\"\n", entry.name); + TRACE("Adding built-in entry \"%s\"\n", entry.name.c_str()); } @@ -1160,7 +1160,7 @@ al::vector<EnumeratedHrtf> EnumerateHrtf(const char *devname) { auto iter = std::find_if(list.begin(), list.end(), [defaulthrtf](const EnumeratedHrtf &entry) -> bool - { return strcmp(entry.name, defaulthrtf) == 0; } + { return entry.name == defaulthrtf; } ); if(iter == list.end()) WARN("Failed to find default HRTF \"%s\"\n", defaulthrtf); @@ -1175,15 +1175,6 @@ al::vector<EnumeratedHrtf> EnumerateHrtf(const char *devname) return list; } -void FreeHrtfList(al::vector<EnumeratedHrtf> &list) -{ - std::for_each(list.begin(), list.end(), - [](EnumeratedHrtf &entry) noexcept -> void - { al_free(entry.name); } - ); - list.clear(); -} - struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry) { std::lock_guard<std::mutex> _{LoadedHrtfLock}; |