mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-28 12:04:47 +02:00
wallet: refactor: inline function ReadOrderPos()
Since accounts were removed in commit c9c32e6b84
,
this function is only called at one place and thus can be as well inlined. Also,
avoid a duplicate lookup by using the find() method and dereference, instead of
calling count() and operator[].
This commit is contained in:
@@ -20,17 +20,6 @@
|
||||
typedef std::map<std::string, std::string> mapValue_t;
|
||||
|
||||
|
||||
static inline void ReadOrderPos(int64_t& nOrderPos, mapValue_t& mapValue)
|
||||
{
|
||||
if (!mapValue.count("n"))
|
||||
{
|
||||
nOrderPos = -1; // TODO: calculate elsewhere
|
||||
return;
|
||||
}
|
||||
nOrderPos = atoi64(mapValue["n"]);
|
||||
}
|
||||
|
||||
|
||||
static inline void WriteOrderPos(const int64_t& nOrderPos, mapValue_t& mapValue)
|
||||
{
|
||||
if (nOrderPos == -1)
|
||||
@@ -232,7 +221,8 @@ public:
|
||||
setConfirmed();
|
||||
}
|
||||
|
||||
ReadOrderPos(nOrderPos, mapValue);
|
||||
const auto it_op = mapValue.find("n");
|
||||
nOrderPos = (it_op != mapValue.end()) ? atoi64(it_op->second) : -1;
|
||||
nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(mapValue["timesmart"]) : 0;
|
||||
|
||||
mapValue.erase("fromaccount");
|
||||
|
Reference in New Issue
Block a user