Re: [PATCH 30/33] tree-diff: convert diff_tree_paths to struct object_id

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

 



On Tue, May 30, 2017 at 10:31 AM, Brandon Williams <bmwill@xxxxxxxxxx> wrote:
>
> Signed-off-by: Brandon Williams <bmwill@xxxxxxxxxx>
> ---
>  combine-diff.c | 10 +++++-----
>  diff.h         |  4 ++--
>  tree-diff.c    | 63 +++++++++++++++++++++++++++++-----------------------------
>  3 files changed, 39 insertions(+), 38 deletions(-)
>
> diff --git a/combine-diff.c b/combine-diff.c
> index 04c4ae856..ec9d93044 100644
> --- a/combine-diff.c
> +++ b/combine-diff.c
> @@ -1364,22 +1364,22 @@ static struct combine_diff_path *find_paths_multitree(
>         struct diff_options *opt)
>  {
>         int i, nparent = parents->nr;
> -       const unsigned char **parents_sha1;
> +       const struct object_id **parents_oid;
>         struct combine_diff_path paths_head;
>         struct strbuf base;
>
> -       ALLOC_ARRAY(parents_sha1, nparent);
> +       ALLOC_ARRAY(parents_oid, nparent);
>         for (i = 0; i < nparent; i++)
> -               parents_sha1[i] = parents->oid[i].hash;
> +               parents_oid[i] = &parents->oid[i];

I have the impression that we could get away with one layer less
of indirection. Previously we had a heap allocated array (*) of (char*),
now we'd have a an array (*) of pointers(*) of the oid struct, that
is a (char[]) essentially. Maybe I am just confused?



[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]