Re: [PATCH v16 Part II 5/8] bisect--helper: `bisect_next_check` shell function in C
- From
Stephan Beyer <s-beyer@gmx.net>
- Date
- Nov 12, 2017, 19:19 UTC
- Message-ID
- <d0994817-25be-25b8-565e-d81c5f18b210@gmx.net>
- In-Reply-To
- <0102015f5e5ee2ca-bf824205-86e6-4259-b7d7-a68e2fbb087d-000000@eu-west-1.amazonses.com>
Hi,
another minor:
On 10/27/2017 05:06 PM, Pranit Bauva wrote:
Show 32 quoted lines
> @@ -264,6 +271,79 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
> return 0;
> }
>
> +static int mark_good(const char *refname, const struct object_id *oid,
> + int flag, void *cb_data)
> +{
> + int *m_good = (int *)cb_data;
> + *m_good = 0;
> + return 1;
> +}
> +
> +static int bisect_next_check(const struct bisect_terms *terms,
> + const char *current_term)
> +{
> + int missing_good = 1, missing_bad = 1, retval = 0;
> + const char *bad_ref = xstrfmt("refs/bisect/%s", terms->term_bad);
> + const char *good_glob = xstrfmt("%s-*", terms->term_good);
> +
> + if (ref_exists(bad_ref))
> + missing_bad = 0;
> +
> + for_each_glob_ref_in(mark_good, good_glob, "refs/bisect/",
> + (void *) &missing_good);
> +
> + if (!missing_good && !missing_bad)
> + goto finish;
> +
> + if (!current_term)
> + goto fail;
> +
> + if (missing_good && !missing_bad && current_term &&This check for "current_term" is not necessary; it can be asserted to be non-NULL, otherwise you would have jumped to "fail"
Stephan