Re: [PATCH 30/33] tree-diff: convert diff_tree_paths to struct object_id
- From
Stefan Beller <sbeller@google.com>
- Date
- May 31, 2017, 18:24 UTC
- Message-ID
- <CAGZ79kZjVvk8GoUFMnR7XJMDyvjkKPhw_7kUYPFq_ShcW50pVQ@mail.gmail.com>
- In-Reply-To
- <20170530173109.54904-31-bmwill@google.com>
On Tue, May 30, 2017 at 10:31 AM, Brandon Williams <bmwill@google.com> wrote:
Show 26 quoted lines
>
> Signed-off-by: Brandon Williams <bmwill@google.com>
> ---
> 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?