From fd7b1ecc3414d5b2c33ce56e4b6da5e1838db769 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 5 Mar 2016 16:11:41 -0600 Subject: [PATCH] Removed potentially-misleading dead code and comment Since ptr is being passed by value to the lambda expression, setting ptr to null will have no effect past that single line. The combination of the code and the comment which implies there is an additional benefit/security in doing so might mislead a maintainer or developer down the road. --- hdr/sqlite_modern_cpp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hdr/sqlite_modern_cpp.h b/hdr/sqlite_modern_cpp.h index 92ca0e00..52bc6f73 100644 --- a/hdr/sqlite_modern_cpp.h +++ b/hdr/sqlite_modern_cpp.h @@ -280,8 +280,8 @@ namespace sqlite { sqlite3* tmp = nullptr; auto ret = sqlite3_open16(db_name.data(), &tmp); if(ret != SQLITE_OK) exceptions::throw_sqlite_error(ret); - _db = std::shared_ptr(tmp, [=](sqlite3* ptr) { sqlite3_close_v2(ptr); ptr = nullptr; }); // close and null to be sure - //_db.reset(tmp, sqlite3_close); // alternative close. (faster?) + _db = std::shared_ptr(tmp, [=](sqlite3* ptr) { sqlite3_close_v2(ptr); }); + //_db.reset(tmp, sqlite3_close); // alternative close. (faster?) } database(std::string const & db_name):