diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 9cb1f0d77..9ce806f25 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -1291,18 +1291,6 @@ size_t TDB2::data_size () return pending._file.size () + completed._file.size () + undo._file.size () + backlog._file.size (); } -//////////////////////////////////////////////////////////////////////////////// -void TDB2::clear () -{ - pending.clear (); - completed.clear (); - undo.clear (); - backlog.clear (); - - _location = ""; - _id = 1; -} - //////////////////////////////////////////////////////////////////////////////// void TDB2::dump () { diff --git a/src/TDB2.h b/src/TDB2.h index df61acd39..a20a20e41 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -141,7 +141,6 @@ public: int num_reverts_possible (); size_t data_size (); - void clear (); void dump (); private: diff --git a/test/tdb2.t.cpp b/test/tdb2.t.cpp index 1d1accfdc..7bec3e3f0 100644 --- a/test/tdb2.t.cpp +++ b/test/tdb2.t.cpp @@ -33,6 +33,16 @@ Context context; +void cleardb () +{ + // Remove any residual test files. + rmdir ("./extensions"); + unlink ("./pending.data"); + unlink ("./completed.data"); + unlink ("./undo.data"); + unlink ("./backlog.data"); +} + //////////////////////////////////////////////////////////////////////////////// int main (int, char**) { @@ -44,12 +54,7 @@ int main (int, char**) try { - // Remove any residual test files. - rmdir ("./extensions"); - unlink ("./pending.data"); - unlink ("./completed.data"); - unlink ("./undo.data"); - unlink ("./backlog.data"); + cleardb (); // Set the context to allow GC. context.config.set ("gc", 1); @@ -98,7 +103,7 @@ int main (int, char**) context.tdb2.commit (); // Reset for reuse. - context.tdb2.clear (); + cleardb (); context.tdb2.set_location ("."); // TODO commit