Re: [PATCH v10 5/7] bisect: simplify the addition of new bisect terms

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

 



On Fri, Jun 26, 2015 at 6:58 PM, Matthieu Moy <Matthieu.Moy@xxxxxxx> wrote:
>
>  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 = STRBUF_INIT;
> +       int status;
> +       strbuf_addf(&bisect_refs, "refs/bisect/%s", name_bad);
> +       status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, cb_data);
> +       strbuf_release(&bisect_refs);
> +       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 = STRBUF_INIT;
> +       int status;
> +       strbuf_addf(&bisect_refs, "refs/bisect/%s", name_good);
> +       status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, cb_data);
> +       strbuf_release(&bisect_refs);
> +       return status;
>  }

I wonder if it would not be better to just have:

static int for_each_bisect_ref(const char *submodule, each_ref_fn fn,
const char *term, void *cb_data)
{
      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;
}

This way it can be used with either name_good, name_bad or "skip" as
the term argument.
--
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]