Skip to content

Commit

Permalink
dbwrapper: Remove throw keywords in function signatures
Browse files Browse the repository at this point in the history
Using throw() specifications in function signatures is not only
not required in C++, it is considered deprecated for
[various reasons](https://stackoverflow.com/questions/1055387/throw-keyword-in-functions-signature).
It is not implemented by any of the common C++ compilers. The usage is
also inconsistent with the rest of the source code.
  • Loading branch information
laanwj committed Apr 23, 2016
1 parent 04a2937 commit 74f7b12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/dbwrapper.cpp
Expand Up @@ -15,7 +15,7 @@
#include <memenv.h>
#include <stdint.h>

void HandleError(const leveldb::Status& status) throw(dbwrapper_error)
void HandleError(const leveldb::Status& status)
{
if (status.ok())
return;
Expand Down Expand Up @@ -102,7 +102,7 @@ CDBWrapper::~CDBWrapper()
options.env = NULL;
}

bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync) throw(dbwrapper_error)
bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
{
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
HandleError(status);
Expand Down
14 changes: 7 additions & 7 deletions src/dbwrapper.h
Expand Up @@ -23,7 +23,7 @@ class dbwrapper_error : public std::runtime_error
dbwrapper_error(const std::string& msg) : std::runtime_error(msg) {}
};

void HandleError(const leveldb::Status& status) throw(dbwrapper_error);
void HandleError(const leveldb::Status& status);

/** Batch of changes queued to be written to a CDBWrapper */
class CDBBatch
Expand Down Expand Up @@ -180,7 +180,7 @@ class CDBWrapper
~CDBWrapper();

template <typename K, typename V>
bool Read(const K& key, V& value) const throw(dbwrapper_error)
bool Read(const K& key, V& value) const
{
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
Expand All @@ -206,15 +206,15 @@ class CDBWrapper
}

template <typename K, typename V>
bool Write(const K& key, const V& value, bool fSync = false) throw(dbwrapper_error)
bool Write(const K& key, const V& value, bool fSync = false)
{
CDBBatch batch(&obfuscate_key);
batch.Write(key, value);
return WriteBatch(batch, fSync);
}

template <typename K>
bool Exists(const K& key) const throw(dbwrapper_error)
bool Exists(const K& key) const
{
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
Expand All @@ -233,22 +233,22 @@ class CDBWrapper
}

template <typename K>
bool Erase(const K& key, bool fSync = false) throw(dbwrapper_error)
bool Erase(const K& key, bool fSync = false)
{
CDBBatch batch(&obfuscate_key);
batch.Erase(key);
return WriteBatch(batch, fSync);
}

bool WriteBatch(CDBBatch& batch, bool fSync = false) throw(dbwrapper_error);
bool WriteBatch(CDBBatch& batch, bool fSync = false);

// not available for LevelDB; provide for compatibility with BDB
bool Flush()
{
return true;
}

bool Sync() throw(dbwrapper_error)
bool Sync()
{
CDBBatch batch(&obfuscate_key);
return WriteBatch(batch, true);
Expand Down

0 comments on commit 74f7b12

Please sign in to comment.