db/simple: make borrowed_song_count "mutable"
Simpler to use than const_cast.
This commit is contained in:
parent
bde27ccec3
commit
ba372197fb
|
@ -206,7 +206,7 @@ SimpleDatabase::GetSong(const char *uri, Error &error) const
|
|||
"No such song: %s", uri);
|
||||
#ifndef NDEBUG
|
||||
else
|
||||
++const_cast<unsigned &>(borrowed_song_count);
|
||||
++borrowed_song_count;
|
||||
#endif
|
||||
|
||||
return song;
|
||||
|
@ -219,7 +219,7 @@ SimpleDatabase::ReturnSong(gcc_unused Song *song) const
|
|||
|
||||
#ifndef NDEBUG
|
||||
assert(borrowed_song_count > 0);
|
||||
--const_cast<unsigned &>(borrowed_song_count);
|
||||
--borrowed_song_count;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class SimpleDatabase : public Database {
|
|||
time_t mtime;
|
||||
|
||||
#ifndef NDEBUG
|
||||
unsigned borrowed_song_count;
|
||||
mutable unsigned borrowed_song_count;
|
||||
#endif
|
||||
|
||||
SimpleDatabase()
|
||||
|
|
Loading…
Reference in New Issue