Skip to content
Myr

main.c: Remove unused EXIT_STATUS_EXACT option

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by Emanuele Torre · committed by Nico Williams · parent 623ace2 · Browse files · 1 file+1 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−3 removed

  • other:+1 added−3 removed

1 file+1 added−3 removed

modified:src/main.c+1 added-3 removed
159 unmodified lines
160 FROM_FILE = 512,161 RAW_NO_LF = 1024,162 UNBUFFERED_OUTPUT = 2048,163 EXIT_STATUS = 4096,164 EXIT_STATUS_EXACT = 8192,164 SEQ = 16384,165 RUN_TESTS = 32768,166 /* debugging only */167 DUMP_DISASM = 65536,
61 unmodified lines
229 fflush(stdout);230 }231 if (jq_halted(jq)) {232 // jq program invoked `halt` or `halt_error`234 options |= EXIT_STATUS_EXACT;233 jv exit_code = jq_get_exit_code(jq);234 if (!jv_is_valid(exit_code))235 ret = JQ_OK;236 else if (jv_get_kind(exit_code) == JV_KIND_NUMBER)
543 unmodified lines
780 jv_free(program_arguments);781 jq_util_input_free(&input_state);782 jq_teardown(&jq);783786 if (options & (EXIT_STATUS|EXIT_STATUS_EXACT)) {784 if (options & EXIT_STATUS) {785 if (ret != JQ_OK_NO_OUTPUT)786 jq_exit_with_status(ret);787 else788 switch (last_result) {
7 unmodified lines