db/simple: eliminate UpdateFileInArchive() if archive API is disabled
Reduce some unnecessary overhead.
This commit is contained in:
@@ -52,9 +52,13 @@ Song::LoadFile(Storage &storage, const char *path_utf8, Directory &parent)
|
|||||||
Song *song = NewFile(path_utf8, parent);
|
Song *song = NewFile(path_utf8, parent);
|
||||||
|
|
||||||
//in archive ?
|
//in archive ?
|
||||||
bool success = parent.device == DEVICE_INARCHIVE
|
bool success =
|
||||||
|
#ifdef ENABLE_ARCHIVE
|
||||||
|
parent.device == DEVICE_INARCHIVE
|
||||||
? song->UpdateFileInArchive(storage)
|
? song->UpdateFileInArchive(storage)
|
||||||
: song->UpdateFile(storage);
|
:
|
||||||
|
#endif
|
||||||
|
song->UpdateFile(storage);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
song->Free();
|
song->Free();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -113,6 +117,10 @@ Song::UpdateFile(Storage &storage)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_ARCHIVE
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Song::UpdateFileInArchive(const Storage &storage)
|
Song::UpdateFileInArchive(const Storage &storage)
|
||||||
{
|
{
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#ifndef MPD_SONG_HXX
|
#ifndef MPD_SONG_HXX
|
||||||
#define MPD_SONG_HXX
|
#define MPD_SONG_HXX
|
||||||
|
|
||||||
|
#include "check.h"
|
||||||
#include "Chrono.hxx"
|
#include "Chrono.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
@@ -109,7 +110,10 @@ struct Song {
|
|||||||
void Free();
|
void Free();
|
||||||
|
|
||||||
bool UpdateFile(Storage &storage);
|
bool UpdateFile(Storage &storage);
|
||||||
|
|
||||||
|
#ifdef ENABLE_ARCHIVE
|
||||||
bool UpdateFileInArchive(const Storage &storage);
|
bool UpdateFileInArchive(const Storage &storage);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the URI of the song in UTF-8 encoding, including its
|
* Returns the URI of the song in UTF-8 encoding, including its
|
||||||
|
Reference in New Issue
Block a user