Add an AlignedFreeDeleter and remove scoped_ptr_malloc.
- Transition scoped_ptr_mallocs to scoped_ptr.
- AlignedFreeDeleter matches Chromium's version.
TESTED=try bots
R=turaj@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/8969005
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5587 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/system_wrappers/interface/scoped_ptr.h b/webrtc/system_wrappers/interface/scoped_ptr.h
index aeac77a..fb20363 100644
--- a/webrtc/system_wrappers/interface/scoped_ptr.h
+++ b/webrtc/system_wrappers/interface/scoped_ptr.h
@@ -96,7 +96,7 @@
#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SCOPED_PTR_H_
// This is an implementation designed to match the anticipated future TR2
-// implementation of the scoped_ptr class and scoped_ptr_malloc (deprecated).
+// implementation of the scoped_ptr class.
#include <assert.h>
#include <stddef.h>
@@ -639,77 +639,6 @@
a.swap(b);
}
-// DEPRECATED: Use scoped_ptr<C, webrtc::FreeDeleter> instead.
-// TODO(ajm): Remove scoped_ptr_malloc.
-//
-// scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a
-// second template argument, the function used to free the object.
-
-template<typename T, void (*FF)(void*) = free> class scoped_ptr_malloc {
- private:
-
- T* ptr;
-
- scoped_ptr_malloc(scoped_ptr_malloc const &);
- scoped_ptr_malloc & operator=(scoped_ptr_malloc const &);
-
- public:
-
- typedef T element_type;
-
- explicit scoped_ptr_malloc(T* p = 0): ptr(p) {}
-
- ~scoped_ptr_malloc() {
- FF(static_cast<void*>(ptr));
- }
-
- void reset(T* p = 0) {
- if (ptr != p) {
- FF(static_cast<void*>(ptr));
- ptr = p;
- }
- }
-
- T& operator*() const {
- assert(ptr != 0);
- return *ptr;
- }
-
- T* operator->() const {
- assert(ptr != 0);
- return ptr;
- }
-
- T* get() const {
- return ptr;
- }
-
- void swap(scoped_ptr_malloc & b) {
- T* tmp = b.ptr;
- b.ptr = ptr;
- ptr = tmp;
- }
-
- T* release() {
- T* tmp = ptr;
- ptr = 0;
- return tmp;
- }
-
- T** accept() {
- if (ptr) {
- FF(static_cast<void*>(ptr));
- ptr = 0;
- }
- return &ptr;
- }
-};
-
-template<typename T, void (*FF)(void*)> inline
-void swap(scoped_ptr_malloc<T,FF>& a, scoped_ptr_malloc<T,FF>& b) {
- a.swap(b);
-}
-
} // namespace webrtc
#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SCOPED_PTR_H_