delete of NULL pointer is noop, so no need to check #48499

Closed
opened 2016-05-23 02:35:48 +02:00 by Lawrence D'Oliveiro · 17 comments

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.

0001-delete-of-NULL-pointer-is-noop-so-no-need-to-check.patch

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. [0001-delete-of-NULL-pointer-is-noop-so-no-need-to-check.patch](https://archive.blender.org/developer/F314348/0001-delete-of-NULL-pointer-is-noop-so-no-need-to-check.patch)

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @ldo

Added subscriber: @ldo

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2016-05-23 09:24:45 +02:00

Please do not recreate same task I just closed, this is uselessly rude. I already answered, and this has nothing to do on our tracker anyway. If you want more info/discussion about it, use IRC or ML.

Please **do not** recreate same task I just closed, this is uselessly rude. I already answered, and this has nothing to do on our tracker anyway. If you want more info/discussion about it, use IRC or ML.

Not to mention this is a totally harmless style issue, nothing actually wrong with this code!

Not to mention this is a totally harmless style issue, nothing actually wrong with this code!

Changed status from 'Archived' to: 'Open'

Changed status from 'Archived' to: 'Open'

This is not the same task.

This is not the same task.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

This is exactly the same task as #48491. Please let task triaging to developpers and stop reopening them and making noise in tracker, we do not need this!

This is exactly the same task as #48491. Please let task triaging to developpers and stop reopening them and making noise in tracker, we do not need this!

Are you saying the GHOST code is off limits for patches as well?

Are you saying the GHOST code is off limits for patches as well?

Changed status from 'Archived' to: 'Open'

Changed status from 'Archived' to: 'Open'

sigh… Next time, please mention what your patch is about (what piece of code it affects) in the report… Sorry, but this report looked totally the same as #48491, so no, did not think about looking at patch file itself. GHOST is maintained by us indeed, and totally eligible to patches submission.

About patch itself, looks good, but please try to respect indentation, and replace 0 by NULL for pointer assignments. ;)

*sigh…* Next time, please mention what your patch is about (what piece of code it affects) in the report… Sorry, but this report looked totally the same as #48491, so no, did not think about looking at patch file itself. GHOST **is** maintained by us indeed, and totally eligible to patches submission. About patch itself, looks good, but please try to respect indentation, and replace `0` by `NULL` for pointer assignments. ;)

Added subscriber: @Sergey

Added subscriber: @Sergey

Something is wrong with indentation. Other than that seems fine.

Something is wrong with indentation. Other than that seems fine.

Bastien, are you looking into applying this?

Bastien, are you looking into applying this?

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#48499
No description provided.