git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/8] Add delta-islands.{c,h}

From
Christian Couder <christian.couder@gmail.com>
Date
Aug 11, 2018, 10:32 UTC
Message-ID
<CAP8UFD0uoOKyUkNDrQgzcf6rGtnd9-Jk26swtzdyNDeCHefYJA@mail.gmail.com>
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:
Show 15 quoted lines
>> 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!
Previous: SZEDER GáborNext: Jeff King
Message 11 of 14 in “Add delta islands support”
  1. 0/8 Add delta islands supportChristian Couder, Aug 9, 2018
  2. 1/8 packfile: make get_delta_base() non staticChristian Couder, Aug 9, 2018
  3. 3/8 pack-objects: refactor code into compute_layer_order()Christian Couder, Aug 9, 2018
  4. 5/8 repack: add delta-islands supportChristian Couder, Aug 9, 2018
  5. 4/8 pack-objects: add delta-islands supportChristian Couder, Aug 9, 2018
  6. 6/8 t: add t5319-delta-islands.shChristian Couder, Aug 9, 2018
  7. 7/8 pack-objects: move tree_depth into 'struct packing_data'Christian Couder, Aug 9, 2018
  8. 8/8 pack-objects: move 'layer' into 'struct packing_data'Christian Couder, Aug 9, 2018
  9. 2/8 Add delta-islands.{c,h}Christian Couder, Aug 9, 2018
  10. SZEDER GáborAug 11, 2018
  11. Christian CouderAug 11, 2018
  12. Jeff KingAug 11, 2018
  13. Christian CouderAug 12, 2018
  14. Christian CouderAug 9, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.