Skip to content

Commit

Permalink
builtin-pack-objects.c: avoid vla
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
gitster committed Sep 1, 2009
1 parent eeefa7c commit dcda361
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ static void *threaded_find_deltas(void *arg)
static void ll_find_deltas(struct object_entry **list, unsigned list_size,
int window, int depth, unsigned *processed)
{
struct thread_params p[delta_search_threads];
struct thread_params *p;
int i, ret, active_threads = 0;

if (delta_search_threads <= 1) {
Expand All @@ -1609,6 +1609,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
if (progress > pack_to_stdout)
fprintf(stderr, "Delta compression using up to %d threads.\n",
delta_search_threads);
p = xcalloc(delta_search_threads, sizeof(*p));

/* Partition the work amongst work threads. */
for (i = 0; i < delta_search_threads; i++) {
Expand Down Expand Up @@ -1717,6 +1718,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
active_threads--;
}
}
free(p);
}

#else
Expand Down

0 comments on commit dcda361

Please sign in to comment.