Skip to content

Commit

Permalink
pack-objects: get rid of an ugly cast
Browse files Browse the repository at this point in the history
... when calling write_idx_file().

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nicolas Pitre authored and Junio C Hamano committed Nov 2, 2007
1 parent 4d00bda commit 79814f4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct object_entry {
* nice "minimum seek" order.
*/
static struct object_entry *objects;
static struct object_entry **written_list;
static struct pack_idx_entry **written_list;
static uint32_t nr_objects, nr_alloc, nr_result, nr_written;

static int non_empty;
Expand Down Expand Up @@ -579,7 +579,7 @@ static off_t write_one(struct sha1file *f,
e->idx.offset = 0;
return 0;
}
written_list[nr_written++] = e;
written_list[nr_written++] = &e->idx;

/* make sure off_t is sufficiently large not to wrap */
if (offset > offset + size)
Expand Down Expand Up @@ -607,7 +607,7 @@ static void write_pack_file(void)

if (do_progress)
start_progress(&progress_state, "Writing %u objects...", "", nr_result);
written_list = xmalloc(nr_objects * sizeof(struct object_entry *));
written_list = xmalloc(nr_objects * sizeof(*written_list));

do {
unsigned char sha1[20];
Expand Down Expand Up @@ -654,8 +654,8 @@ static void write_pack_file(void)
umask(mode);
mode = 0444 & ~mode;

idx_tmp_name = write_idx_file(NULL,
(struct pack_idx_entry **) written_list, nr_written, sha1);
idx_tmp_name = write_idx_file(NULL, written_list,
nr_written, sha1);
snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
base_name, sha1_to_hex(sha1));
if (adjust_perm(pack_tmp_name, mode))
Expand All @@ -677,7 +677,7 @@ static void write_pack_file(void)

/* mark written objects as written to previous pack */
for (j = 0; j < nr_written; j++) {
written_list[j]->idx.offset = (off_t)-1;
written_list[j]->offset = (off_t)-1;
}
nr_remaining -= nr_written;
} while (nr_remaining && i < nr_objects);
Expand Down

0 comments on commit 79814f4

Please sign in to comment.