Skip to content

Commit b3582ba

Browse files
committed
wallet: bdb: move SafeDbt to cpp file
Dbt requires including bdb headers.
1 parent e5e5aa1 commit b3582ba

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/wallet/bdb.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,26 @@ BerkeleyEnvironment::BerkeleyEnvironment() : m_use_shared_memory(false)
232232
fMockDb = true;
233233
}
234234

235+
/** RAII class that automatically cleanses its data on destruction */
236+
class SafeDbt final
237+
{
238+
Dbt m_dbt;
239+
240+
public:
241+
// construct Dbt with internally-managed data
242+
SafeDbt();
243+
// construct Dbt with provided data
244+
SafeDbt(void* data, size_t size);
245+
~SafeDbt();
246+
247+
// delegate to Dbt
248+
const void* get_data() const;
249+
uint32_t get_size() const;
250+
251+
// conversion operator to access the underlying Dbt
252+
operator Dbt*();
253+
};
254+
235255
SafeDbt::SafeDbt()
236256
{
237257
m_dbt.set_flags(DB_DBT_MALLOC);

src/wallet/bdb.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,6 @@ class BerkeleyDatabase : public WalletDatabase
152152
std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) override;
153153
};
154154

155-
/** RAII class that automatically cleanses its data on destruction */
156-
class SafeDbt final
157-
{
158-
Dbt m_dbt;
159-
160-
public:
161-
// construct Dbt with internally-managed data
162-
SafeDbt();
163-
// construct Dbt with provided data
164-
SafeDbt(void* data, size_t size);
165-
~SafeDbt();
166-
167-
// delegate to Dbt
168-
const void* get_data() const;
169-
uint32_t get_size() const;
170-
171-
// conversion operator to access the underlying Dbt
172-
operator Dbt*();
173-
};
174-
175155
class BerkeleyCursor : public DatabaseCursor
176156
{
177157
private:

0 commit comments

Comments
 (0)