git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: git <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 12:32:32 +0200	[thread overview]
Message-ID: <CAP8UFD0uoOKyUkNDrQgzcf6rGtnd9-Jk26swtzdyNDeCHefYJA@mail.gmail.com> (raw)
In-Reply-To: <20180811090418.26674-1-szeder.dev@gmail.com>

On Sat, Aug 11, 2018 at 11:04 AM, SZEDER Gábor <szeder.dev@gmail.com> wrote:
>> 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.

Ok, I have made the following changes in the branch I will send next.

diff --git a/delta-islands.c b/delta-islands.c
index 92137f2eca..22e4360810 100644
--- a/delta-islands.c
+++ b/delta-islands.c
@@ -322,8 +322,7 @@ static int island_config_callback(const char *k,
const char *v, void *cb)

                if (island_regexes_nr >= island_regexes_alloc) {
                        island_regexes_alloc = (island_regexes_alloc + 8) * 2;
-                       island_regexes = xrealloc(island_regexes,
-                                       island_regexes_alloc * sizeof(regex_t));
+                       REALLOC_ARRAY(island_regexes, island_regexes_alloc);
                }

                if (*v != '^')
@@ -425,7 +424,7 @@ static void deduplicate_islands(void)
        unsigned int island_count, dst, src, ref, i = 0;

        island_count = kh_size(remote_islands);
-       list = xmalloc(island_count * sizeof(struct remote_island *));
+       ALLOC_ARRAY(list, island_count);

        kh_foreach_value(remote_islands, island, {
                list[i++] = island;

Thanks!

  reply	other threads:[~2018-08-11 10:32 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
2018-08-11 10:32     ` Christian Couder [this message]
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=CAP8UFD0uoOKyUkNDrQgzcf6rGtnd9-Jk26swtzdyNDeCHefYJA@mail.gmail.com \
    --to=christian.couder@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    --cc=szeder.dev@gmail.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).