Maniphest T48491

delete of NULL pointer is noop, so no need to check
Closed, Archived

Assigned To
Bastien Montagne (mont29)
Authored By
Lawrence D'Oliveiro (ldo)
May 22 2016, 8:40 AM
Tags
  • BF Blender
Subscribers
Bastien Montagne (mont29)
Lawrence D'Oliveiro (ldo)

Description

In C++, it is unnecessary to check for non-NULL before invoking delete:

if (foo) delete foo;

can be more simply written as

delete foo;

(Ref: section 5.3.5 of the C++98 spec, paragraph 2.)

This patch just fixes some initial cases I came across; no doubt there are others waiting to be found.

Event Timeline

Lawrence D'Oliveiro (ldo) created this task.May 22 2016, 8:40 AM
Lawrence D'Oliveiro (ldo) raised the priority of this task from to 90.
Lawrence D'Oliveiro (ldo) updated the task description.
Lawrence D'Oliveiro (ldo) added a project: BF Blender.
Lawrence D'Oliveiro (ldo) edited a custom field.
Lawrence D'Oliveiro (ldo) added a subscriber: Lawrence D'Oliveiro (ldo).

Sorry, I should have marked this as a patch, not a bug.

Bastien Montagne (mont29) changed the task status from Unknown Status to Archived.May 22 2016, 6:51 PM
Bastien Montagne (mont29) claimed this task.
Bastien Montagne (mont29) added a subscriber: Bastien Montagne (mont29).

Thanks for the patch, be we for sure won’t touch to extern library's code - not until it’s a question of live or death for Blender! :P

Suggest you report the issue to carve team.

Lawrence D'Oliveiro (ldo) added a comment.May 23 2016, 2:50 AM

I see the header files refer to http://carve-csg.com/, which no longer exists.

So where is this “carve team” to be found?