@matheusbsbs / matheus-bagliano / commits / dcda3614d4
Fork 0

builtin-pack-objects.c: avoid vla

This is one of only two places that we use C99 variable length array on the stack, which some older compilers apparently are not happy with. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 1, 2009 at 02:18 UTC dcda3614d44bf83aaeb7632353ab668bc689986c
1 file changed +3 -1
builtin-pack-objects.c
+3 -1
@@ -1599,7 +1599,7 @@ static void *threaded_find_deltas(void *arg)
1599 static void ll_find_deltas(struct object_entry **list, unsigned list_size,
1600 int window, int depth, unsigned *processed)
1601 {
1602 - struct thread_params p[delta_search_threads];
1602 + struct thread_params *p;
1603 int i, ret, active_threads = 0;
1604
1605 if (delta_search_threads <= 1) {
@@ -1609,6 +1609,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
1609 if (progress > pack_to_stdout)
1610 fprintf(stderr, "Delta compression using up to %d threads.\n",
1611 delta_search_threads);
1612 + p = xcalloc(delta_search_threads, sizeof(*p));
1613
1614 /* Partition the work amongst work threads. */
1615 for (i = 0; i < delta_search_threads; i++) {
@@ -1717,6 +1718,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
1718 active_threads--;
1719 }
1720 }
1721 + free(p);
1722 }
1723
1724 #else