Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code clean at io.netty.buffer.AbstractByteBuf#adjustMarkers #11032

Closed
horizonzy opened this issue Feb 21, 2021 · 0 comments · Fixed by #11033
Closed

Code clean at io.netty.buffer.AbstractByteBuf#adjustMarkers #11032

horizonzy opened this issue Feb 21, 2021 · 0 comments · Fixed by #11033
Milestone

Comments

@horizonzy
Copy link
Contributor

protected final void adjustMarkers(int decrement) {
int markedReaderIndex = this.markedReaderIndex;
if (markedReaderIndex <= decrement) {
this.markedReaderIndex = 0;
int markedWriterIndex = this.markedWriterIndex;
if (markedWriterIndex <= decrement) {
this.markedWriterIndex = 0;
} else {
this.markedWriterIndex = markedWriterIndex - decrement;
}
} else {
this.markedReaderIndex = markedReaderIndex - decrement;
markedWriterIndex -= decrement;
}
}

It's unnecessary to create stack variable.

@normanmaurer normanmaurer added this to the 4.1.60.Final milestone Feb 23, 2021
normanmaurer pushed a commit that referenced this issue Feb 23, 2021
Motivation:

No extra variable is needed.

Modification:

Remove extra variable

Result:

Fixes #11032
raidyue pushed a commit to raidyue/netty that referenced this issue Jul 8, 2022
Motivation:

No extra variable is needed.

Modification:

Remove extra variable

Result:

Fixes netty#11032
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 a pull request may close this issue.

2 participants