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

Remove redundant conditionals and an assignment. #34

Closed
wants to merge 4 commits into from

Conversation

shinji-s
Copy link
Contributor

@shinji-s shinji-s commented Aug 2, 2020

Breaking out of the while loop and falling through guarantees that 'gm' is NULL.
!c->multi_support is equivalent to prev==NULL.

@FussyDuck
Copy link

FussyDuck commented Aug 2, 2020

CLA assistant check
All committers have signed the CLA.

@shahramn
Copy link
Collaborator

shahramn commented Aug 2, 2020

Can you please provide a test case that demonstrates the problem

@shinji-s
Copy link
Contributor Author

shinji-s commented Aug 2, 2020

There is no logical problem in the code. Hence I can think of no appropriate test cases that demonstrate any problem. This PR is about code clarity.

  • It does not make sense to assign a value to a local variable if the variable is not going to be referenced after the assignment.
  • There is no point in checking a variable for a value if the value being held is known. The extra check potentially wastes cpu cycles and, more importantly, makes code difficult to comprehend.

@shinji-s
Copy link
Contributor Author

Closing as this PR is superceded by #51.

@shinji-s shinji-s closed this Nov 16, 2020
@shinji-s shinji-s deleted the pr_remove_conditionals branch November 16, 2020 12:15
FussyDuck pushed a commit that referenced this pull request Aug 1, 2022
Merge in ECCODES/eccodes from bugfix/ECC-1431-CCSDS-OutputBufferSize to develop

* commit '7374409c4706ad099a8d76de5e34e9d53369a5c0':
  ECC-1431: Simplified test
  ECC-1431: Fix loop initialization
  ECC-1431: Limit test values to the range of float
  ECC-1431: Minor changes
  ECC-1431: Add failed condition
  ECC-1431: Adding missing set function
  ECC-1431: Build test only if C++ enabled
  ECC-1431: Minor fix
  ECC-1431: Test
  ECC-1431: Test language changed from .c to .cpp
  ECC-1431: Preparations for testing
  ECC-1431: Simplified output buffer size formula
  ECC-1431: Fixed output buffer size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants