Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

fix_issue583_Remove unnecessary null pointer checks #1140

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cinn/runtime/buffer.cc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Shape::Shape(const Shape &other) : data_(new value_type[other.ndims()]), ndims_(
void Shape::Resize(int ndim) {
CHECK_GT(ndim, 0);
ndims_ = ndim;
if (data_) delete data_;
enkilee marked this conversation as resolved.
Show resolved Hide resolved
delete data_;
data_ = new value_type[ndim];
}

Expand Down
5 changes: 1 addition & 4 deletions cinn/runtime/buffer.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ class Buffer {
CHECK(data_) << "alloc buffer failed";
}
//! Deallocate the memory in host device.
void DeallocHost() {
if (data_) delete data_;
data_ = nullptr;
}
void DeallocHost() { data_ = nullptr; }
enkilee marked this conversation as resolved.
Show resolved Hide resolved

T& operator()(int i0) {
CHECK_EQ(shape_.ndims(), 1);
Expand Down