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

main.c: Remove unused EXIT_STATUS_EXACT option #2915

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

emanuele6
Copy link
Member

@emanuele6 emanuele6 commented Sep 28, 2023

In process there is a suspicious options |= EXIT_STATUS_EXACT that is run when the jq script is terminated by halt, or halt_error.

That line of code acutally does nothing because options is a local argument variable, and is not passed as a pointer. It was probably meant
to be a *options |= EXIT_STATUS_EXACT with the options argument passed as a int *.

In any case, we do not want to run the code in main() that was supposed to run if EXIT_STATUS_EXACT is set (but didn't since it is never added to options); as far as I can tell, we only want to run that code when the --exit-status/-e option is passed.

So I removed EXIT_STATUS_EXACT completely, and the useless assignment, instead of fixing it since it was not used for anything else.

Useless assignment detected by clang-tidy.

In process there is a suspicious  options |= EXIT_STATUS_EXACT  that
is run when the jq script is terminated by halt, or halt_error.

That line of code acutally does nothing because options is a local
argument variable, and is not passed as a pointer. It was probably meant
to be a   *options |= EXIT_STATUS_EXACT   with the options argument
passed as a int*.

In any case, we do not want to run the code in main() that was supposed
to run if EXIT_STATUS_EXACT is set (but didn't since it is never added
to options); as far as I can tell, we only want to run that code when
the --exit-status/-e option is passed.

So I removed EXIT_STATUS_EXACT completely, and the useless assignment,
instead of fixing it since it was not used for anything else.

Useless assignment detected by clang-tidy.
@emanuele6 emanuele6 added the lint Code cleanup; style fixes; small refactors; dead code removal; etc. label Sep 28, 2023
@nicowilliams nicowilliams merged commit 8206bc8 into jqlang:master Sep 28, 2023
28 checks passed
@nicowilliams
Copy link
Contributor

Thanks!

@emanuele6 emanuele6 deleted the exact branch September 28, 2023 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lint Code cleanup; style fixes; small refactors; dead code removal; etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants