Remove a bunch of unused variables, and useless assignments

Detected by clang-tidy.
This commit is contained in:
Emanuele Torre authored and Nico Williams committed 2023-09-27 21:50:44 -05:00
1 parent 2b709727a9
commit 623ace27e8
4 files changed
+3 -5

No files matched your search

+1 -1
View File
@@ -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);
-1
View File
@@ -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;
}
+1 -2
View File
@@ -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
}
+1 -1
View File
@@ -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;
}