Skip to content

Commit f4f8a2c

Browse files
author
tb
committed
bio chain test: rename a few variables for consistency
1 parent 5312697 commit f4f8a2c

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/regress/lib/libcrypto/bio/bio_chain.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: bio_chain.c,v 1.4 2022/12/08 18:15:36 tb Exp $ */
1+
/* $OpenBSD: bio_chain.c,v 1.5 2022/12/08 18:16:28 tb Exp $ */
22
/*
33
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
44
*
@@ -193,23 +193,23 @@ bio_chain_pop_test(void)
193193
}
194194

195195
static int
196-
walk_forward(BIO *start, BIO *end, size_t expected_length,
197-
size_t i, size_t j, const char *fn, const char *description)
196+
walk_forward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j,
197+
const char *fn, const char *description)
198198
{
199199
BIO *prev, *next;
200-
size_t length;
200+
size_t len;
201201
int ret = 0;
202202

203203
if (start == NULL || end == NULL)
204204
goto done;
205205

206206
next = start;
207-
length = 0;
207+
len = 0;
208208

209209
do {
210210
prev = next;
211211
next = BIO_next(prev);
212-
length++;
212+
len++;
213213
} while (next != NULL);
214214

215215
if (prev != end) {
@@ -218,10 +218,10 @@ walk_forward(BIO *start, BIO *end, size_t expected_length,
218218
goto err;
219219
}
220220

221-
if (length != expected_length) {
221+
if (len != expected_len) {
222222
fprintf(stderr, "%s case (%zu, %zu) %s length "
223223
"(walking forward) want: %zu, got %zu\n",
224-
fn, i, j, description, expected_length, length);
224+
fn, i, j, description, expected_len, len);
225225
goto err;
226226
}
227227

@@ -233,22 +233,22 @@ walk_forward(BIO *start, BIO *end, size_t expected_length,
233233
}
234234

235235
static int
236-
walk_backward(BIO *start, BIO *end, size_t expected_length,
237-
size_t i, size_t j, const char *fn, const char *description)
236+
walk_backward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j,
237+
const char *fn, const char *description)
238238
{
239239
BIO *prev, *next;
240-
size_t length;
240+
size_t len;
241241
int ret = 0;
242242

243243
if (start == NULL || end == NULL)
244244
goto done;
245245

246-
length = 0;
246+
len = 0;
247247
prev = end;
248248
do {
249249
next = prev;
250250
prev = BIO_prev(prev);
251-
length++;
251+
len++;
252252
} while (prev != NULL);
253253

254254
if (next != start) {
@@ -257,10 +257,10 @@ walk_backward(BIO *start, BIO *end, size_t expected_length,
257257
goto err;
258258
}
259259

260-
if (length != expected_length) {
260+
if (len != expected_len) {
261261
fprintf(stderr, "%s case (%zu, %zu) %s length "
262262
"(walking backward) want: %zu, got %zu\n",
263-
fn, i, j, description, expected_length, length);
263+
fn, i, j, description, expected_len, len);
264264
goto err;
265265
}
266266

@@ -272,12 +272,12 @@ walk_backward(BIO *start, BIO *end, size_t expected_length,
272272
}
273273

274274
static int
275-
check_chain(BIO *start, BIO *end, size_t expected_length,
276-
size_t i, size_t j, const char *fn, const char *description)
275+
check_chain(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j,
276+
const char *fn, const char *description)
277277
{
278-
if (!walk_forward(start, end, expected_length, i, j, fn, description))
278+
if (!walk_forward(start, end, expected_len, i, j, fn, description))
279279
return 0;
280-
if (!walk_backward(start, end, expected_length, i, j, fn, description))
280+
if (!walk_backward(start, end, expected_len, i, j, fn, description))
281281
return 0;
282282

283283
return 1;
@@ -332,7 +332,7 @@ link_chains_at(size_t i, size_t j, int use_bio_push)
332332
BIO *A[LINK_CHAIN_A_LEN], *B[LINK_CHAIN_B_LEN];
333333
BIO *new_start, *new_end;
334334
BIO *oldhead_start, *oldhead_end, *oldtail_start, *oldtail_end;
335-
size_t new_length, oldhead_length, oldtail_length;
335+
size_t new_len, oldhead_len, oldtail_len;
336336
int failed = 1;
337337

338338
memset(A, 0, sizeof(A));
@@ -354,29 +354,29 @@ link_chains_at(size_t i, size_t j, int use_bio_push)
354354
new_start = A[0];
355355
new_end = B[nitems(B) - 1];
356356

357-
oldhead_length = j;
357+
oldhead_len = j;
358358
oldhead_start = B[0];
359359
oldhead_end = BIO_prev(B[j]);
360360

361361
/* If we push B[0] or set next to B[0], the oldhead chain is empty. */
362362
if (j == 0) {
363-
oldhead_length = 0;
363+
oldhead_len = 0;
364364
oldhead_start = NULL;
365365
}
366366

367367
if (use_bio_push) {
368-
new_length = nitems(A) + nitems(B) - j;
368+
new_len = nitems(A) + nitems(B) - j;
369369

370370
/* oldtail doesn't exist in the BIO_push() case. */
371371
oldtail_start = NULL;
372372
oldtail_end = NULL;
373-
oldtail_length = 0;
373+
oldtail_len = 0;
374374
} else {
375-
new_length = i + 1 + nitems(B) - j;
375+
new_len = i + 1 + nitems(B) - j;
376376

377377
oldtail_start = BIO_next(A[i]);
378378
oldtail_end = A[nitems(A) - 1];
379-
oldtail_length = nitems(A) - i - 1;
379+
oldtail_len = nitems(A) - i - 1;
380380
}
381381

382382
/*
@@ -397,14 +397,14 @@ link_chains_at(size_t i, size_t j, int use_bio_push)
397397
* Check that all the chains match our expectations.
398398
*/
399399

400-
if (!check_chain(new_start, new_end, new_length, i, j, fn, "new chain"))
400+
if (!check_chain(new_start, new_end, new_len, i, j, fn, "new chain"))
401401
goto err;
402402

403-
if (!check_chain(oldhead_start, oldhead_end, oldhead_length, i, j, fn,
403+
if (!check_chain(oldhead_start, oldhead_end, oldhead_len, i, j, fn,
404404
"oldhead"))
405405
goto err;
406406

407-
if (!check_chain(oldtail_start, oldtail_end, oldtail_length, i, j, fn,
407+
if (!check_chain(oldtail_start, oldtail_end, oldtail_len, i, j, fn,
408408
"oldtail"))
409409
goto err;
410410

0 commit comments

Comments
 (0)