add detach back to SkAutoMalloc

Review URL: http://codereview.appspot.com/4956066/


git-svn-id: http://skia.googlecode.com/svn/trunk@2218 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2011-09-06 15:02:33 +00:00
parent bdf736133b
commit 6dcd27cd5e

View File

@ -444,6 +444,17 @@ public:
void* get() { return fPtr; }
const void* get() const { return fPtr; }
/** Transfer ownership of the current ptr to the caller, setting the
internal reference to null. Note the caller is reponsible for calling
sk_free on the returned address.
*/
void* detach() {
void* ptr = fPtr;
fPtr = NULL;
fSize = 0;
return ptr;
}
/**
* Gets the size of the block in bytes
*/