diff options
author | Emanuele Torre <torreemanuele6@gmail.com> | 2023-09-28 03:20:49 +0200 |
---|---|---|
committer | Nico Williams <nico@cryptonector.com> | 2023-09-27 21:50:44 -0500 |
commit | 623ace27e881c0daa43c73201f8131cf8b9c2cec (patch) | |
tree | e139d865c8d85ebfc912b0e58a7b852eaff38b97 | |
parent | 2b709727a9654eee3f36399b5fc6b0f83396e7a7 (diff) |
Remove a bunch of unused variables, and useless assignments
Detected by clang-tidy.
-rw-r--r-- | src/execute.c | 2 | ||||
-rw-r--r-- | src/jq_test.c | 1 | ||||
-rw-r--r-- | src/jv.c | 3 | ||||
-rw-r--r-- | src/util.c | 2 |
4 files changed, 3 insertions, 5 deletions
diff --git a/src/execute.c b/src/execute.c index 02af8232..9ef83683 100644 --- a/src/execute.c +++ b/src/execute.c @@ -1242,7 +1242,7 @@ int jq_compile_args(jq_state *jq, const char* str, jv args) { if (nerrors == 0) { nerrors = builtins_bind(jq, &program); if (nerrors == 0) { - nerrors = block_compile(program, &jq->bc, locations, args = args2obj(args)); + nerrors = block_compile(program, &jq->bc, locations, args2obj(args)); } } else jv_free(args); diff --git a/src/jq_test.c b/src/jq_test.c index 4505c19a..39456861 100644 --- a/src/jq_test.c +++ b/src/jq_test.c @@ -127,7 +127,6 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int take--; } else if (take == 0) { printf("Hit the number of tests limit (%d), breaking\n", tests_to_take); - take = -1; break; } @@ -1080,14 +1080,13 @@ static jvp_string* jvp_string_alloc(uint32_t size) { static jv jvp_string_copy_replace_bad(const char* data, uint32_t length) { const char* end = data + length; const char* i = data; - const char* cstart; uint32_t maxlength = length * 3 + 1; // worst case: all bad bytes, each becomes a 3-byte U+FFFD jvp_string* s = jvp_string_alloc(maxlength); char* out = s->data; int c = 0; - while ((i = jvp_utf8_next((cstart = i), end, &c))) { + while ((i = jvp_utf8_next(i, end, &c))) { if (c == -1) { c = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER } @@ -353,7 +353,7 @@ static int jq_util_input_read_more(jq_util_input_state *state) { * terminating '\0'. This only works because we previously memset our * buffer with something nonzero. */ - for (p = state->buf, i = sizeof(state->buf) - 1; i > 0; i--) { + for (i = sizeof(state->buf) - 1; i > 0; i--) { if (state->buf[i] == '\0') break; } |