From: Patrick Donnelly Date: Mon, 24 Oct 2016 20:35:09 +0000 (-0400) Subject: mds: use unique_ptr unstable_bits_t in SimpleLock X-Git-Tag: v11.1.0~170^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F11635%2Fhead;p=ceph.git mds: use unique_ptr unstable_bits_t in SimpleLock Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/SimpleLock.h b/src/mds/SimpleLock.h index 736fab5cb4c9..3b62f55b437c 100644 --- a/src/mds/SimpleLock.h +++ b/src/mds/SimpleLock.h @@ -192,18 +192,17 @@ private: excl_client(-1) {} }; - mutable unstable_bits_t *_unstable; + mutable std::unique_ptr _unstable; bool have_more() const { return _unstable ? true : false; } unstable_bits_t *more() const { if (!_unstable) - _unstable = new unstable_bits_t; - return _unstable; + _unstable.reset(new unstable_bits_t); + return _unstable.get(); } void try_clear_more() { if (_unstable && _unstable->empty()) { - delete _unstable; - _unstable = NULL; + _unstable.reset(); } } @@ -223,12 +222,9 @@ public: parent(o), state(LOCK_SYNC), num_rdlock(0), - num_client_lease(0), - _unstable(NULL) + num_client_lease(0) {} - virtual ~SimpleLock() { - delete _unstable; - } + virtual ~SimpleLock() {} virtual bool is_scatterlock() const { return false;