提交 dcda3614 编写于 作者: J Junio C Hamano

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: NJunio C Hamano <gitster@pobox.com>
上级 eeefa7c9
...@@ -1599,7 +1599,7 @@ static void *threaded_find_deltas(void *arg) ...@@ -1599,7 +1599,7 @@ static void *threaded_find_deltas(void *arg)
static void ll_find_deltas(struct object_entry **list, unsigned list_size, static void ll_find_deltas(struct object_entry **list, unsigned list_size,
int window, int depth, unsigned *processed) int window, int depth, unsigned *processed)
{ {
struct thread_params p[delta_search_threads]; struct thread_params *p;
int i, ret, active_threads = 0; int i, ret, active_threads = 0;
if (delta_search_threads <= 1) { if (delta_search_threads <= 1) {
...@@ -1609,6 +1609,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size, ...@@ -1609,6 +1609,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
if (progress > pack_to_stdout) if (progress > pack_to_stdout)
fprintf(stderr, "Delta compression using up to %d threads.\n", fprintf(stderr, "Delta compression using up to %d threads.\n",
delta_search_threads); delta_search_threads);
p = xcalloc(delta_search_threads, sizeof(*p));
/* Partition the work amongst work threads. */ /* Partition the work amongst work threads. */
for (i = 0; i < delta_search_threads; i++) { for (i = 0; i < delta_search_threads; i++) {
...@@ -1717,6 +1718,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size, ...@@ -1717,6 +1718,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
active_threads--; active_threads--;
} }
} }
free(p);
} }
#else #else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册