Re: [PATCH v7 3/5] bisect: simplify the addition of new bisect terms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 23, 2015 at 8:54 AM, Matthieu Moy <Matthieu.Moy@xxxxxxx> wrote:
> diff --git a/revision.c b/revision.c
> index 3ff8723..f22923f 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -2076,14 +2079,32 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
>         ctx->argc -= n;
>  }
>
> +extern void read_bisect_terms(const char **bad, const char **good);
> +
>  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);
> +       struct strbuf bisect_refs_buf = STRBUF_INIT;
> +       const char *bisect_refs_str;
> +       int status;
> +       strbuf_addstr(&bisect_refs_buf, "refs/bisect/");
> +       strbuf_addstr(&bisect_refs_buf, name_bad);

A single strbuf_addf() rather than two strbuf_addstr()s?

> +       bisect_refs_str = strbuf_detach(&bisect_refs_buf, NULL);
> +       status = for_each_ref_in_submodule(submodule, bisect_refs_str, fn, cb_data);
> +       free((char *)bisect_refs_str);

Why the above rather than the simpler?

    strbuf_addstr(&bisect_refs, ...);
    status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, cb_data);
    strbuf_release(&bisect_refs);

What am I missing?

> +       return status;
>  }
>
>  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);
> +       struct strbuf bisect_refs_buf = STRBUF_INIT;
> +       const char *bisect_refs_str;
> +       int status;
> +       strbuf_addstr(&bisect_refs_buf, "refs/bisect/");
> +       strbuf_addstr(&bisect_refs_buf, name_bad);
> +       bisect_refs_str = strbuf_detach(&bisect_refs_buf, NULL);
> +       status = for_each_ref_in_submodule(submodule, bisect_refs_str, fn, cb_data);
> +       free((char *)bisect_refs_str);

Ditto.

> +       return status;
>  }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]