Skip to content

Couple of Null check corrections#44

Open
ya1gaurav wants to merge 4 commits intoboostorg:developfrom
ya1gaurav:patch-1
Open

Couple of Null check corrections#44
ya1gaurav wants to merge 4 commits intoboostorg:developfrom
ya1gaurav:patch-1

Conversation

@ya1gaurav
Copy link
Copy Markdown
Contributor

  1. m_to_python is checked against Null at line 70, but not checked at 89.
  2. !! is same as without using this.

1. m_to_python is checked against Null at line 70, but not checked at 89.
2. !! is same as without using this.
Applied patch to free node when node->next is Null but node is Non-Null.
if condition modified to use else.
@ya1gaurav
Copy link
Copy Markdown
Contributor Author

Please review updated patches. Thanks.

Comment thread src/converter/registry.cpp Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are checking if node is not null two times instead of one. And the delete operator is a no-op when the pointer is null, this whole thing can be simply written as:

if (node != 0)
    delete_node(node->next);
delete node;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree delete NULL is safe.

delete handles NULL pointer, so there is no harm in removing extra NULL checks.
@stefanseefeld stefanseefeld force-pushed the develop branch 2 times, most recently from 8ccdcff to 3ace4a0 Compare October 8, 2016 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants