Skip to content

Commit 292731c

Browse files
tanushree27gitster
authored andcommitted
bisect--helper: change retval to res
Let's rename variable retval to res, so that variable names in bisect--helper.c are more consistent. After this change, there are 110 occurrences of res in the file and zero of retval, while there were 26 instances of retval before. Mentored-by: Christian Couder <[email protected]> Signed-off-by: Tanushree Tumane <[email protected]> Signed-off-by: Miriam Rubio <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16538bf commit 292731c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

builtin/bisect--helper.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -206,31 +206,31 @@ static int bisect_write(const char *state, const char *rev,
206206
struct object_id oid;
207207
struct commit *commit;
208208
FILE *fp = NULL;
209-
int retval = 0;
209+
int res = 0;
210210

211211
if (!strcmp(state, terms->term_bad)) {
212212
strbuf_addf(&tag, "refs/bisect/%s", state);
213213
} else if (one_of(state, terms->term_good, "skip", NULL)) {
214214
strbuf_addf(&tag, "refs/bisect/%s-%s", state, rev);
215215
} else {
216-
retval = error(_("Bad bisect_write argument: %s"), state);
216+
res = error(_("Bad bisect_write argument: %s"), state);
217217
goto finish;
218218
}
219219

220220
if (get_oid(rev, &oid)) {
221-
retval = error(_("couldn't get the oid of the rev '%s'"), rev);
221+
res = error(_("couldn't get the oid of the rev '%s'"), rev);
222222
goto finish;
223223
}
224224

225225
if (update_ref(NULL, tag.buf, &oid, NULL, 0,
226226
UPDATE_REFS_MSG_ON_ERR)) {
227-
retval = -1;
227+
res = -1;
228228
goto finish;
229229
}
230230

231231
fp = fopen(git_path_bisect_log(), "a");
232232
if (!fp) {
233-
retval = error_errno(_("couldn't open the file '%s'"), git_path_bisect_log());
233+
res = error_errno(_("couldn't open the file '%s'"), git_path_bisect_log());
234234
goto finish;
235235
}
236236

@@ -244,7 +244,7 @@ static int bisect_write(const char *state, const char *rev,
244244
if (fp)
245245
fclose(fp);
246246
strbuf_release(&tag);
247-
return retval;
247+
return res;
248248
}
249249

250250
static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
@@ -294,7 +294,7 @@ static const char need_bisect_start_warning[] =
294294
static int bisect_next_check(const struct bisect_terms *terms,
295295
const char *current_term)
296296
{
297-
int missing_good = 1, missing_bad = 1, retval = 0;
297+
int missing_good = 1, missing_bad = 1, res = 0;
298298
const char *bad_ref = xstrfmt("refs/bisect/%s", terms->term_bad);
299299
const char *good_glob = xstrfmt("%s-*", terms->term_good);
300300

@@ -308,7 +308,7 @@ static int bisect_next_check(const struct bisect_terms *terms,
308308
goto finish;
309309

310310
if (!current_term) {
311-
retval = -1;
311+
res = -1;
312312
goto finish;
313313
}
314314

@@ -329,21 +329,21 @@ static int bisect_next_check(const struct bisect_terms *terms,
329329
*/
330330
yesno = git_prompt(_("Are you sure [Y/n]? "), PROMPT_ECHO);
331331
if (starts_with(yesno, "N") || starts_with(yesno, "n"))
332-
retval = -1;
332+
res = -1;
333333
goto finish;
334334
}
335335
if (!is_empty_or_missing_file(git_path_bisect_start())) {
336-
retval = error(_(need_bad_and_good_revision_warning),
336+
res = error(_(need_bad_and_good_revision_warning),
337337
vocab_bad, vocab_good, vocab_bad, vocab_good);
338338
} else {
339-
retval = error(_(need_bisect_start_warning),
339+
res = error(_(need_bisect_start_warning),
340340
vocab_good, vocab_bad, vocab_good, vocab_bad);
341341
}
342342

343343
finish:
344344
free((void *) good_glob);
345345
free((void *) bad_ref);
346-
return retval;
346+
return res;
347347
}
348348

349349
static int get_terms(struct bisect_terms *terms)
@@ -397,33 +397,33 @@ static int bisect_terms(struct bisect_terms *terms, const char *option)
397397

398398
static int bisect_append_log_quoted(const char **argv)
399399
{
400-
int retval = 0;
400+
int res = 0;
401401
FILE *fp = fopen(git_path_bisect_log(), "a");
402402
struct strbuf orig_args = STRBUF_INIT;
403403

404404
if (!fp)
405405
return -1;
406406

407407
if (fprintf(fp, "git bisect start") < 1) {
408-
retval = -1;
408+
res = -1;
409409
goto finish;
410410
}
411411

412412
sq_quote_argv(&orig_args, argv);
413413
if (fprintf(fp, "%s\n", orig_args.buf) < 1)
414-
retval = -1;
414+
res = -1;
415415

416416
finish:
417417
fclose(fp);
418418
strbuf_release(&orig_args);
419-
return retval;
419+
return res;
420420
}
421421

422422
static int bisect_start(struct bisect_terms *terms, int no_checkout,
423423
const char **argv, int argc)
424424
{
425425
int i, has_double_dash = 0, must_write_terms = 0, bad_seen = 0;
426-
int flags, pathspec_pos, retval = 0;
426+
int flags, pathspec_pos, res = 0;
427427
struct string_list revs = STRING_LIST_INIT_DUP;
428428
struct string_list states = STRING_LIST_INIT_DUP;
429429
struct strbuf start_head = STRBUF_INIT;
@@ -524,7 +524,7 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
524524
argv_array_pushl(&argv, "checkout", start_head.buf,
525525
"--", NULL);
526526
if (run_command_v_opt(argv.argv, RUN_GIT_CMD)) {
527-
retval = error(_("checking out '%s' failed."
527+
res = error(_("checking out '%s' failed."
528528
" Try 'git bisect start "
529529
"<valid-branch>'."),
530530
start_head.buf);
@@ -572,12 +572,12 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
572572

573573
if (no_checkout) {
574574
if (get_oid(start_head.buf, &oid) < 0) {
575-
retval = error(_("invalid ref: '%s'"), start_head.buf);
575+
res = error(_("invalid ref: '%s'"), start_head.buf);
576576
goto finish;
577577
}
578578
if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0,
579579
UPDATE_REFS_MSG_ON_ERR)) {
580-
retval = -1;
580+
res = -1;
581581
goto finish;
582582
}
583583
}
@@ -589,26 +589,26 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
589589
for (i = 0; i < states.nr; i++)
590590
if (bisect_write(states.items[i].string,
591591
revs.items[i].string, terms, 1)) {
592-
retval = -1;
592+
res = -1;
593593
goto finish;
594594
}
595595

596596
if (must_write_terms && write_terms(terms->term_bad,
597597
terms->term_good)) {
598-
retval = -1;
598+
res = -1;
599599
goto finish;
600600
}
601601

602-
retval = bisect_append_log_quoted(argv);
603-
if (retval)
604-
retval = -1;
602+
res = bisect_append_log_quoted(argv);
603+
if (res)
604+
res = -1;
605605

606606
finish:
607607
string_list_clear(&revs, 0);
608608
string_list_clear(&states, 0);
609609
strbuf_release(&start_head);
610610
strbuf_release(&bisect_names);
611-
return retval;
611+
return res;
612612
}
613613

614614
int cmd_bisect__helper(int argc, const char **argv, const char *prefix)

0 commit comments

Comments
 (0)