reftable: inline merged_table_release()

The function `merged_table_release()` releases a merged table, whereas
`reftable_merged_table_free()` releases a merged table and then also
free's its pointer. But all callsites of `merged_table_release()` are in
fact followed by `reftable_merged_table_free()`, which is redundant.

Inline `merged_table_release()` into `reftable_merged_table_free()` to
get rid of this redundance.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-06-06 07:29:30 +02:00 committed by Junio C Hamano
parent b3e098d6e7
commit b5d7db9e83
3 changed files with 4 additions and 18 deletions

View File

@ -207,19 +207,11 @@ int reftable_new_merged_table(struct reftable_merged_table **dest,
return 0;
}
/* clears the list of subtable, without affecting the readers themselves. */
void merged_table_release(struct reftable_merged_table *mt)
{
FREE_AND_NULL(mt->stack);
mt->stack_len = 0;
}
void reftable_merged_table_free(struct reftable_merged_table *mt)
{
if (!mt) {
if (!mt)
return;
}
merged_table_release(mt);
FREE_AND_NULL(mt->stack);
reftable_free(mt);
}

View File

@ -24,6 +24,4 @@ struct reftable_merged_table {
uint64_t max;
};
void merged_table_release(struct reftable_merged_table *mt);
#endif

View File

@ -261,10 +261,8 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
new_tables = NULL;
st->readers_len = new_readers_len;
if (st->merged) {
merged_table_release(st->merged);
if (st->merged)
reftable_merged_table_free(st->merged);
}
if (st->readers) {
reftable_free(st->readers);
}
@ -968,10 +966,8 @@ static int stack_write_compact(struct reftable_stack *st,
done:
reftable_iterator_destroy(&it);
if (mt) {
merged_table_release(mt);
if (mt)
reftable_merged_table_free(mt);
}
reftable_ref_record_release(&ref);
reftable_log_record_release(&log);
st->stats.entries_written += entries;