Re: [PATCH 30/33] tree-diff: convert diff_tree_paths to struct object_id
From: Stefan Beller <hidden>
Date: 2017-05-31 18:24:55
On Tue, May 30, 2017 at 10:31 AM, Brandon Williams [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Brandon Williams <redacted> --- 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?