pack-objects: get rid of an ugly cast
... when calling write_idx_file(). Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nicolas Pitre committed
Nov 1, 2007 at 23:43 UTC
79814f425c00129dbdbdc3c99d04af52ccc58254
1 file changed
+6
-6
builtin-pack-objects.c
+6
-6
@@ -57,7 +57,7 @@ struct object_entry {
57
* nice "minimum seek" order.
58
*/
59
static struct object_entry *objects;
60
-static struct object_entry **written_list;
60
+static struct pack_idx_entry **written_list;
61
static uint32_t nr_objects, nr_alloc, nr_result, nr_written;
62
63
static int non_empty;
@@ -579,7 +579,7 @@ static off_t write_one(struct sha1file *f,
579
e->idx.offset = 0;
580
return 0;
581
}
582
- written_list[nr_written++] = e;
582
+ written_list[nr_written++] = &e->idx;
583
584
/* make sure off_t is sufficiently large not to wrap */
585
if (offset > offset + size)
@@ -607,7 +607,7 @@ static void write_pack_file(void)
607
608
if (do_progress)
609
start_progress(&progress_state, "Writing %u objects...", "", nr_result);
610
- written_list = xmalloc(nr_objects * sizeof(struct object_entry *));
610
+ written_list = xmalloc(nr_objects * sizeof(*written_list));
611
612
do {
613
unsigned char sha1[20];
@@ -654,8 +654,8 @@ static void write_pack_file(void)
654
umask(mode);
655
mode = 0444 & ~mode;
656
657
- idx_tmp_name = write_idx_file(NULL,
658
- (struct pack_idx_entry **) written_list, nr_written, sha1);
657
+ idx_tmp_name = write_idx_file(NULL, written_list,
658
+ nr_written, sha1);
659
snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
660
base_name, sha1_to_hex(sha1));
661
if (adjust_perm(pack_tmp_name, mode))
@@ -677,7 +677,7 @@ static void write_pack_file(void)
677
678
/* mark written objects as written to previous pack */
679
for (j = 0; j < nr_written; j++) {
680
- written_list[j]->idx.offset = (off_t)-1;
680
+ written_list[j]->offset = (off_t)-1;
681
}
682
nr_remaining -= nr_written;
683
} while (nr_remaining && i < nr_objects);