pack-bitmap: introduce bitmap_writer_free()
Now that there is clearer memory ownership around the bitmap_writer structure, introduce a bitmap_writer_free() function that callers may use to free any memory associated with their instance of the bitmap_writer structure. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f25e1f2a4d
commit
85f360fee5
@ -32,6 +32,29 @@ void bitmap_writer_init(struct bitmap_writer *writer)
|
||||
memset(writer, 0, sizeof(struct bitmap_writer));
|
||||
}
|
||||
|
||||
void bitmap_writer_free(struct bitmap_writer *writer)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
if (!writer)
|
||||
return;
|
||||
|
||||
ewah_free(writer->commits);
|
||||
ewah_free(writer->trees);
|
||||
ewah_free(writer->blobs);
|
||||
ewah_free(writer->tags);
|
||||
|
||||
kh_destroy_oid_map(writer->bitmaps);
|
||||
|
||||
for (i = 0; i < writer->selected_nr; i++) {
|
||||
struct bitmapped_commit *bc = &writer->selected[i];
|
||||
if (bc->write_as != bc->bitmap)
|
||||
ewah_free(bc->write_as);
|
||||
ewah_free(bc->bitmap);
|
||||
}
|
||||
free(writer->selected);
|
||||
}
|
||||
|
||||
void bitmap_writer_show_progress(struct bitmap_writer *writer, int show)
|
||||
{
|
||||
writer->show_progress = show;
|
||||
|
Reference in New Issue
Block a user