aboutsummaryrefslogtreecommitdiff
path: root/src/leveldbwrapper.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-09-19 19:21:46 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-09-19 19:21:46 +0200
commit20e01b1a03819d843a860284033b48a5e3b65ff7 (patch)
tree5b390722b053ce5b448919bda2695d173980ffb5 /src/leveldbwrapper.cpp
parent2fc6c67400e91846ca1c1c57011e57491013f9bd (diff)
Apply clang-format on some infrequently-updated files
Diffstat (limited to 'src/leveldbwrapper.cpp')
-rw-r--r--src/leveldbwrapper.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp
index 9e849696a8..8ce3e7b470 100644
--- a/src/leveldbwrapper.cpp
+++ b/src/leveldbwrapper.cpp
@@ -12,7 +12,8 @@
#include <leveldb/filter_policy.h>
#include <memenv.h>
-void HandleError(const leveldb::Status &status) throw(leveldb_error) {
+void HandleError(const leveldb::Status& status) throw(leveldb_error)
+{
if (status.ok())
return;
LogPrintf("%s\n", status.ToString());
@@ -25,7 +26,8 @@ void HandleError(const leveldb::Status &status) throw(leveldb_error) {
throw leveldb_error("Unknown database error");
}
-static leveldb::Options GetOptions(size_t nCacheSize) {
+static leveldb::Options GetOptions(size_t nCacheSize)
+{
leveldb::Options options;
options.block_cache = leveldb::NewLRUCache(nCacheSize / 2);
options.write_buffer_size = nCacheSize / 4; // up to two write buffers may be held in memory simultaneously
@@ -40,7 +42,8 @@ static leveldb::Options GetOptions(size_t nCacheSize) {
return options;
}
-CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory, bool fWipe) {
+CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, bool fMemory, bool fWipe)
+{
penv = NULL;
readoptions.verify_checksums = true;
iteroptions.verify_checksums = true;
@@ -64,7 +67,8 @@ CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path &path, size_t nCa
LogPrintf("Opened LevelDB successfully\n");
}
-CLevelDBWrapper::~CLevelDBWrapper() {
+CLevelDBWrapper::~CLevelDBWrapper()
+{
delete pdb;
pdb = NULL;
delete options.filter_policy;
@@ -75,7 +79,8 @@ CLevelDBWrapper::~CLevelDBWrapper() {
options.env = NULL;
}
-bool CLevelDBWrapper::WriteBatch(CLevelDBBatch &batch, bool fSync) throw(leveldb_error) {
+bool CLevelDBWrapper::WriteBatch(CLevelDBBatch& batch, bool fSync) throw(leveldb_error)
+{
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
HandleError(status);
return true;