Commit ba372197 authored by Max Kellermann's avatar Max Kellermann

db/simple: make borrowed_song_count "mutable"

Simpler to use than const_cast.
parent bde27cce
...@@ -206,7 +206,7 @@ SimpleDatabase::GetSong(const char *uri, Error &error) const ...@@ -206,7 +206,7 @@ SimpleDatabase::GetSong(const char *uri, Error &error) const
"No such song: %s", uri); "No such song: %s", uri);
#ifndef NDEBUG #ifndef NDEBUG
else else
++const_cast<unsigned &>(borrowed_song_count); ++borrowed_song_count;
#endif #endif
return song; return song;
...@@ -219,7 +219,7 @@ SimpleDatabase::ReturnSong(gcc_unused Song *song) const ...@@ -219,7 +219,7 @@ SimpleDatabase::ReturnSong(gcc_unused Song *song) const
#ifndef NDEBUG #ifndef NDEBUG
assert(borrowed_song_count > 0); assert(borrowed_song_count > 0);
--const_cast<unsigned &>(borrowed_song_count); --borrowed_song_count;
#endif #endif
} }
......
...@@ -37,7 +37,7 @@ class SimpleDatabase : public Database { ...@@ -37,7 +37,7 @@ class SimpleDatabase : public Database {
time_t mtime; time_t mtime;
#ifndef NDEBUG #ifndef NDEBUG
unsigned borrowed_song_count; mutable unsigned borrowed_song_count;
#endif #endif
SimpleDatabase() SimpleDatabase()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment