mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 11:57:28 -03:00
wallet: bdb: move SafeDbt to cpp file
Dbt requires including bdb headers.
This commit is contained in:
parent
e5e5aa1da2
commit
b3582baa3a
2 changed files with 20 additions and 20 deletions
|
@ -232,6 +232,26 @@ BerkeleyEnvironment::BerkeleyEnvironment() : m_use_shared_memory(false)
|
|||
fMockDb = true;
|
||||
}
|
||||
|
||||
/** RAII class that automatically cleanses its data on destruction */
|
||||
class SafeDbt final
|
||||
{
|
||||
Dbt m_dbt;
|
||||
|
||||
public:
|
||||
// construct Dbt with internally-managed data
|
||||
SafeDbt();
|
||||
// construct Dbt with provided data
|
||||
SafeDbt(void* data, size_t size);
|
||||
~SafeDbt();
|
||||
|
||||
// delegate to Dbt
|
||||
const void* get_data() const;
|
||||
uint32_t get_size() const;
|
||||
|
||||
// conversion operator to access the underlying Dbt
|
||||
operator Dbt*();
|
||||
};
|
||||
|
||||
SafeDbt::SafeDbt()
|
||||
{
|
||||
m_dbt.set_flags(DB_DBT_MALLOC);
|
||||
|
|
|
@ -152,26 +152,6 @@ public:
|
|||
std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) override;
|
||||
};
|
||||
|
||||
/** RAII class that automatically cleanses its data on destruction */
|
||||
class SafeDbt final
|
||||
{
|
||||
Dbt m_dbt;
|
||||
|
||||
public:
|
||||
// construct Dbt with internally-managed data
|
||||
SafeDbt();
|
||||
// construct Dbt with provided data
|
||||
SafeDbt(void* data, size_t size);
|
||||
~SafeDbt();
|
||||
|
||||
// delegate to Dbt
|
||||
const void* get_data() const;
|
||||
uint32_t get_size() const;
|
||||
|
||||
// conversion operator to access the underlying Dbt
|
||||
operator Dbt*();
|
||||
};
|
||||
|
||||
class BerkeleyCursor : public DatabaseCursor
|
||||
{
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue