aboutsummaryrefslogtreecommitdiff
path: root/src/dbwrapper.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-10-28 16:51:33 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2016-11-07 13:56:22 -0800
commit657e05ab2e87ff725723fe8a375fc3f8aad02126 (patch)
treee20cebbde1dee31d6d21dccdaa2223a5ca1566e3 /src/dbwrapper.h
parentfad9b66504f176ed3624515f3bf4d428cf687607 (diff)
Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid of the specialized GetSerializeSize methods everywhere, and just use CSizeComputer. This removes a lot of code which isn't actually used anywhere. For CCompactSize and CVarInt this actually removes a more efficient size computing algorithm, which is brought back in a later commit.
Diffstat (limited to 'src/dbwrapper.h')
-rw-r--r--src/dbwrapper.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dbwrapper.h b/src/dbwrapper.h
index 47bdb31b5b..7728b49d93 100644
--- a/src/dbwrapper.h
+++ b/src/dbwrapper.h
@@ -60,12 +60,12 @@ public:
void Write(const K& key, const V& value)
{
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
- ssKey.reserve(ssKey.GetSerializeSize(key));
+ ssKey.reserve(GetSerializeSize(ssKey, key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
- ssValue.reserve(ssValue.GetSerializeSize(value));
+ ssValue.reserve(GetSerializeSize(ssValue, value));
ssValue << value;
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
leveldb::Slice slValue(&ssValue[0], ssValue.size());
@@ -77,7 +77,7 @@ public:
void Erase(const K& key)
{
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
- ssKey.reserve(ssKey.GetSerializeSize(key));
+ ssKey.reserve(GetSerializeSize(ssKey, key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
@@ -107,7 +107,7 @@ public:
template<typename K> void Seek(const K& key) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
- ssKey.reserve(ssKey.GetSerializeSize(key));
+ ssKey.reserve(GetSerializeSize(ssKey, key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
piter->Seek(slKey);
@@ -200,7 +200,7 @@ public:
bool Read(const K& key, V& value) const
{
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
- ssKey.reserve(ssKey.GetSerializeSize(key));
+ ssKey.reserve(GetSerializeSize(ssKey, key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
@@ -234,7 +234,7 @@ public:
bool Exists(const K& key) const
{
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
- ssKey.reserve(ssKey.GetSerializeSize(key));
+ ssKey.reserve(GetSerializeSize(ssKey, key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());