Avoid memset(NULL, ...).

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/290453003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21320 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d51e48dc
......@@ -68,7 +68,8 @@ static bool run_shell;
class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
virtual void* Allocate(size_t length) {
return memset(AllocateUninitialized(length), 0, length);
void* data = AllocateUninitialized(length);
return data == NULL ? data : memset(data, 0, length);
}
virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
virtual void Free(void* data, size_t) { free(data); }
......
......@@ -1450,7 +1450,8 @@ static void DumpHeapConstants(i::Isolate* isolate) {
class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
virtual void* Allocate(size_t length) {
return memset(AllocateUninitialized(length), 0, length);
void* data = AllocateUninitialized(length);
return data == NULL ? data : memset(data, 0, length);
}
virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
virtual void Free(void* data, size_t) { free(data); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment