Message ID | 20200423070704.39872-3-mirucam@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Finish converting git bisect to C part 2 | expand |
Hi Miriam, On Thu, 23 Apr 2020, Miriam Rubio wrote: > Following 'enum bisect_error' vocabulary, return variable 'res' is > always non-positive. > Let's use '-res' instead of 'abs(res)' to make the code clearer. I agree with this reasoning, and with the patch. Thank you, Dscho > > Mentored-by: Christian Couder <chriscool@tuxfamily.org> > Signed-off-by: Miriam Rubio <mirucam@gmail.com> > Helped-by: Junio C Hamano <gitster@pobox.com> > --- > builtin/bisect--helper.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c > index a81a2c76ff..0fbd924aac 100644 > --- a/builtin/bisect--helper.c > +++ b/builtin/bisect--helper.c > @@ -722,5 +722,5 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) > if (res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) > res = BISECT_OK; > > - return abs(res); > + return -res; > } > -- > 2.25.0 > >
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index a81a2c76ff..0fbd924aac 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -722,5 +722,5 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) if (res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) res = BISECT_OK; - return abs(res); + return -res; }
Following 'enum bisect_error' vocabulary, return variable 'res' is always non-positive. Let's use '-res' instead of 'abs(res)' to make the code clearer. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Miriam Rubio <mirucam@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> --- builtin/bisect--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)