Skip to content

Fix some Codacy warnings - #6576

Closed
MarcelRaad wants to merge 8 commits into
curl:masterfrom
MarcelRaad:codacy_error_prone
Closed

Fix some Codacy warnings#6576
MarcelRaad wants to merge 8 commits into
curl:masterfrom
MarcelRaad:codacy_error_prone

Conversation

@MarcelRaad

Copy link
Copy Markdown
Member

Mostly remove redundant code and reduce variable scopes.

Comment thread lib/ftp.c
if(bytes) {
/* get the number! */
(void)curlx_strtoofft(bytes, NULL, 0, &size);
(void)curlx_strtoofft(++bytes, NULL, 0, &size);

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

4 participants