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/aligned_malloc.h b/webrtc/system_wrappers/interface/aligned_malloc.h
index 6409999..5d343cd 100644
--- a/webrtc/system_wrappers/interface/aligned_malloc.h
+++ b/webrtc/system_wrappers/interface/aligned_malloc.h
@@ -19,8 +19,6 @@
#include <stddef.h>
-#include "webrtc/system_wrappers/interface/scoped_ptr.h"
-
namespace webrtc {
// Returns a pointer to the first boundry of |alignment| bytes following the
@@ -48,10 +46,12 @@
return reinterpret_cast<T*>(AlignedMalloc(size, alignment));
}
-// Scoped pointer to AlignedMalloc-memory.
-template<typename T>
-struct Allocator {
- typedef scoped_ptr_malloc<T, AlignedFree> scoped_ptr_aligned;
+// Deleter for use with scoped_ptr. E.g., use as
+// scoped_ptr<Foo, AlignedFreeDeleter> foo;
+struct AlignedFreeDeleter {
+ inline void operator()(void* ptr) const {
+ AlignedFree(ptr);
+ }
};
} // namespace webrtc