Skip to content

Commit c966969

Browse files
committed
commit-graph: place bloom_settings in context
Place an instance of struct bloom_settings into the struct write_commit_graph_context. This allows simplifying the function prototype of write_graph_chunk_bloom_data(). This will allow us to combine the function prototypes and use function pointers to simplify write_commit_graph_file(). Reported-by: SZEDER Gábor <[email protected]> Signed-off-by: Derrick Stolee <[email protected]>
1 parent 7fbfe07 commit c966969

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

commit-graph.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ struct write_commit_graph_context {
882882

883883
const struct split_commit_graph_opts *split_opts;
884884
size_t total_bloom_filter_data_size;
885+
struct bloom_filter_settings bloom_settings;
885886
};
886887

887888
static void write_graph_chunk_fanout(struct hashfile *f,
@@ -1103,8 +1104,7 @@ static void write_graph_chunk_bloom_indexes(struct hashfile *f,
11031104
}
11041105

11051106
static void write_graph_chunk_bloom_data(struct hashfile *f,
1106-
struct write_commit_graph_context *ctx,
1107-
const struct bloom_filter_settings *settings)
1107+
struct write_commit_graph_context *ctx)
11081108
{
11091109
struct commit **list = ctx->commits.list;
11101110
struct commit **last = ctx->commits.list + ctx->commits.nr;
@@ -1116,9 +1116,9 @@ static void write_graph_chunk_bloom_data(struct hashfile *f,
11161116
_("Writing changed paths Bloom filters data"),
11171117
ctx->commits.nr);
11181118

1119-
hashwrite_be32(f, settings->hash_version);
1120-
hashwrite_be32(f, settings->num_hashes);
1121-
hashwrite_be32(f, settings->bits_per_entry);
1119+
hashwrite_be32(f, ctx->bloom_settings.hash_version);
1120+
hashwrite_be32(f, ctx->bloom_settings.num_hashes);
1121+
hashwrite_be32(f, ctx->bloom_settings.bits_per_entry);
11221122

11231123
while (list < last) {
11241124
struct bloom_filter *filter = get_bloom_filter(ctx->r, *list, 0);
@@ -1541,6 +1541,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
15411541
struct object_id file_hash;
15421542
const struct bloom_filter_settings bloom_settings = DEFAULT_BLOOM_FILTER_SETTINGS;
15431543

1544+
ctx->bloom_settings = bloom_settings;
1545+
15441546
if (ctx->split) {
15451547
struct strbuf tmp_file = STRBUF_INIT;
15461548

@@ -1642,7 +1644,7 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
16421644
write_graph_chunk_extra_edges(f, ctx);
16431645
if (ctx->changed_paths) {
16441646
write_graph_chunk_bloom_indexes(f, ctx);
1645-
write_graph_chunk_bloom_data(f, ctx, &bloom_settings);
1647+
write_graph_chunk_bloom_data(f, ctx);
16461648
}
16471649
if (ctx->num_commit_graphs_after > 1 &&
16481650
write_graph_chunk_base(f, ctx)) {

0 commit comments

Comments
 (0)