Delete unreachable code in _quicklistInsert() #13158
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR might be same issue with #12613
The point is that in
void _quicklistInsert()
, the conditionif (!node) { ... }
is unreachable.Analysis
Following the function calls, the only two use _quicklistInsert() like below:
RM_ListInsert()
from module.cquicklistTest()
from quicklist.cLINSERT
During checking next node, if the current node is NULL, then it just return 0, so that we cannot reach it.
RM_ListInsert()
Similar with
linsertCommand()
, iterator already check if key exists or pivot exists,so that we will not encounter
if (!node) { ... }
.quicklistTest()
This is for test and callable from other files.
This function calls
quicklistInsertBefore()
andquicklistInsertAfter()
directly, but always following afterquicklistGetIteratorEntryAtIdx()
orquicklistNext()
, soif (!node) { ... }
is unreachable.what I have done
I'm finally sure that
if (!node) { ... }
from_quicklistInsert()
is unreachable, so I have deleted it.If I missed something, then please let me know.
Thanks a lot.