summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2023-09-28 03:20:49 +0200
committerNico Williams <nico@cryptonector.com>2023-09-27 21:50:44 -0500
commit623ace27e881c0daa43c73201f8131cf8b9c2cec (patch)
treee139d865c8d85ebfc912b0e58a7b852eaff38b97
parent2b709727a9654eee3f36399b5fc6b0f83396e7a7 (diff)
Remove a bunch of unused variables, and useless assignments
Detected by clang-tidy.
-rw-r--r--src/execute.c2
-rw-r--r--src/jq_test.c1
-rw-r--r--src/jv.c3
-rw-r--r--src/util.c2
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;
}
diff --git a/src/jv.c b/src/jv.c
index 85541694..eec4ec5a 100644
--- a/src/jv.c
+++ b/src/jv.c
@@ -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
}
diff --git a/src/util.c b/src/util.c
index e35eb906..2f961e3c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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;
}