db/Helpers: use reference instead of pointer
This commit is contained in:
parent
b999e16406
commit
3965b490a9
|
@ -26,6 +26,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
struct StringLess {
|
struct StringLess {
|
||||||
|
@ -40,12 +41,13 @@ typedef std::set<const char *, StringLess> StringSet;
|
||||||
static bool
|
static bool
|
||||||
CollectTags(StringSet &set, TagType tag_type, const LightSong &song)
|
CollectTags(StringSet &set, TagType tag_type, const LightSong &song)
|
||||||
{
|
{
|
||||||
const Tag *tag = song.tag;
|
assert(song.tag != nullptr);
|
||||||
|
const Tag &tag = *song.tag;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (unsigned i = 0; i < tag->num_items; ++i) {
|
for (unsigned i = 0; i < tag.num_items; ++i) {
|
||||||
if (tag->items[i]->type == tag_type) {
|
if (tag.items[i]->type == tag_type) {
|
||||||
set.insert(tag->items[i]->value);
|
set.insert(tag.items[i]->value);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue