Browse Source

thank you, Roker, for the idea with returning the string of the emplaced element ;-)

synchronous
Volker Birk 5 years ago
parent
commit
d01c362804
  1. 11
      passphrase_cache.cc

11
passphrase_cache.cc

@ -1,11 +1,6 @@
#include <cassert>
#include "passphrase_cache.hh"
namespace
{
const char* const empty_string = "";
}
namespace pEp {
PassphraseCache::cache_entry::cache_entry(const std::string& p, time_point t) :
passphrase{p, 0, PassphraseCache::cache_entry::max_len}, tp{t}
@ -42,11 +37,13 @@ namespace pEp {
_cache.pop_front();
_cache.emplace_back(passphrase, clock::now());
auto back = _cache.back(); // FIXME: In C++17 list::emplace_back() returns the just inserted element already.
auto back = _cache.back(); // FIXME: In C++17 list::emplace_back()
// returns the just inserted element
// already.
return back.passphrase.c_str();
}
return empty_string;
return "";
}
bool PassphraseCache::for_each_passphrase(const passphrase_callee& callee)

Loading…
Cancel
Save