Skip to content

Commit

Permalink
Remove unneeeded nullptr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt committed Feb 27, 2016
1 parent 4e77db6 commit b715ef4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions nan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1501,10 +1501,8 @@ class Callback {

if (!persistentHandle.IsEmpty())
persistentHandle.Reset();
if (callback)
delete callback;
if (errmsg_)
delete[] errmsg_;
delete callback;
delete[] errmsg_;
}

virtual void WorkComplete() {
Expand Down Expand Up @@ -1579,9 +1577,7 @@ class Callback {
}

void SetErrorMessage(const char *msg) {
if (errmsg_) {
delete[] errmsg_;
}
delete[] errmsg_;

size_t size = strlen(msg) + 1;
errmsg_ = new char[size];
Expand Down Expand Up @@ -1615,9 +1611,7 @@ class Callback {
virtual ~AsyncProgressWorker() {
uv_mutex_destroy(&async_lock);

if (asyncdata_) {
delete[] asyncdata_;
}
delete[] asyncdata_;
}

void WorkProgress() {
Expand Down Expand Up @@ -1671,9 +1665,7 @@ class Callback {
asyncsize_ = size;
uv_mutex_unlock(&async_lock);

if (old_data) {
delete[] old_data;
}
delete[] old_data;
uv_async_send(async);
}

Expand Down

0 comments on commit b715ef4

Please sign in to comment.