Matthieu Moy <matthieu....@imag.fr> writes:

> We do need two functions because we pass the pointer as callback, but
> it reads nicer with a third helper function.
>
> diff --git a/revision.c b/revision.c
> index 3ff8723..5cd08e9 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -21,6 +21,9 @@
>  
>  volatile show_early_output_fn_t show_early_output;
>  
> +static const char *name_bad;
> +static const char *name_good;
> +
> ...
> +
> +static int for_each_bisect_ref(const char *submodule, each_ref_fn fn, void 
> *cb_data, const char *term) {
> +     struct strbuf bisect_refs = STRBUF_INIT;
> +     int status;
> +     strbuf_addf(&bisect_refs, "refs/bisect/%s", term);
> +     status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, 
> cb_data);
> +     strbuf_release(&bisect_refs);
> +     return status;
> +}
> +
>  static int for_each_bad_bisect_ref(const char *submodule, each_ref_fn fn, 
> void *cb_data)
>  {
> -     return for_each_ref_in_submodule(submodule, "refs/bisect/bad", fn, 
> cb_data);
> +     return for_each_bisect_ref(submodule, fn, cb_data, "bad");
>  }

Shouldn't this be passing name_bad instead of "bad"?

>  
>  static int for_each_good_bisect_ref(const char *submodule, each_ref_fn fn, 
> void *cb_data)
>  {
> -     return for_each_ref_in_submodule(submodule, "refs/bisect/good", fn, 
> cb_data);
> +     return for_each_bisect_ref(submodule, fn, cb_data, "good");
>  }

Likewise.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to