git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Christian Couder <christian.couder@gmail.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Jeff King" <peff@peff.net>, "Duy Nguyen" <pclouds@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Stefan Beller" <sbeller@google.com>,
	"Christian Couder" <chriscool@tuxfamily.org>
Subject: Re: [PATCH v3 2/8] Add delta-islands.{c,h}
Date: Sat, 11 Aug 2018 11:04:18 +0200	[thread overview]
Message-ID: <20180811090418.26674-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <20180809155532.26151-3-chriscool@tuxfamily.org>

> diff --git a/delta-islands.c b/delta-islands.c
> new file mode 100644
> index 0000000000..448ddcbbe4
> --- /dev/null
> +++ b/delta-islands.c

> +static void deduplicate_islands(void)
> +{
> +	struct remote_island *island, *core = NULL, **list;
> +	unsigned int island_count, dst, src, ref, i = 0;
> +
> +	island_count = kh_size(remote_islands);
> +	list = xmalloc(island_count * sizeof(struct remote_island *));

Please use ALLOC_ARRAY here.

> +
> +	kh_foreach_value(remote_islands, island, {
> +		list[i++] = island;
> +	});
> +
> +	for (ref = 0; ref + 1 < island_count; ref++) {
> +		for (src = ref + 1, dst = src; src < island_count; src++) {
> +			if (list[ref]->hash == list[src]->hash)
> +				continue;
> +
> +			if (src != dst)
> +				list[dst] = list[src];
> +
> +			dst++;
> +		}
> +		island_count = dst;
> +	}
> +
> +	island_bitmap_size = (island_count / 32) + 1;
> +	core = get_core_island();
> +
> +	for (i = 0; i < island_count; ++i) {
> +		mark_remote_island_1(list[i], core && list[i]->hash == core->hash);
> +	}
> +
> +	free(list);
> +}

  reply	other threads:[~2018-08-11  9:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 15:55 [PATCH v3 0/8] Add delta islands support Christian Couder
2018-08-09 15:55 ` [PATCH v3 1/8] packfile: make get_delta_base() non static Christian Couder
2018-08-09 15:55 ` [PATCH v3 2/8] Add delta-islands.{c,h} Christian Couder
2018-08-11  9:04   ` SZEDER Gábor [this message]
2018-08-11 10:32     ` Christian Couder
2018-08-11 14:12       ` Jeff King
2018-08-12  4:32         ` Christian Couder
2018-08-09 15:55 ` [PATCH v3 3/8] pack-objects: refactor code into compute_layer_order() Christian Couder
2018-08-09 15:55 ` [PATCH v3 4/8] pack-objects: add delta-islands support Christian Couder
2018-08-09 15:55 ` [PATCH v3 5/8] repack: " Christian Couder
2018-08-09 15:55 ` [PATCH v3 6/8] t: add t5319-delta-islands.sh Christian Couder
2018-08-09 15:55 ` [PATCH v3 7/8] pack-objects: move tree_depth into 'struct packing_data' Christian Couder
2018-08-09 15:55 ` [PATCH v3 8/8] pack-objects: move 'layer' " Christian Couder
2018-08-09 19:34 ` [PATCH v3 0/8] Add delta islands support Christian Couder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180811090418.26674-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).