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

Fix some Codacy warnings #6576

Closed
wants to merge 8 commits into from
Closed

Conversation

MarcelRaad
Copy link
Member

Mostly remove redundant code and reduce variable scopes.

/* get the number! */
(void)curlx_strtoofft(bytes, NULL, 0, &size);
(void)curlx_strtoofft(++bytes, NULL, 0, &size);
Copy link
Member

Choose a reason for hiding this comment

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

Minor nitpick: wouldn't it be more readable to just do bytes++; on its own line before the curlx_strtoofft call?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fine for me too. Personally, I find both equally readable. What do others think?

Copy link
Contributor

Choose a reason for hiding this comment

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

As much as I like terse code, ++bytes; on a separate line makes it easier not to miss. It's not a strong opinion, however.

Copy link
Member

Choose a reason for hiding this comment

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

I'm equally fine with either.

Copy link
Member Author

Choose a reason for hiding this comment

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

I put it on a separate line in the final commit that landed on master.

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Feb 10, 2021
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Feb 10, 2021
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Feb 10, 2021
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Feb 10, 2021
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Feb 10, 2021
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Feb 10, 2021
`end` is always non-null here.

Closes curl#6576
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Feb 10, 2021
As suggested by Codacy/cppcheck.

Closes curl#6576
@MarcelRaad MarcelRaad deleted the codacy_error_prone branch February 10, 2021 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants