Skip to content

Commit eb90719

Browse files
derrickstoleegitster
authored andcommitted
commit-graph: anonymize data in chunk_write_fn
In preparation for creating an API around file formats using chunks and tables of contents, prepare the commit-graph write code to use prototypes that will match this new API. Specifically, convert chunk_write_fn to take a "void *data" parameter instead of the commit-graph-specific "struct write_commit_graph_context" pointer. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5a3b130 commit eb90719

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

commit-graph.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,9 @@ struct write_commit_graph_context {
10401040
};
10411041

10421042
static int write_graph_chunk_fanout(struct hashfile *f,
1043-
struct write_commit_graph_context *ctx)
1043+
void *data)
10441044
{
1045+
struct write_commit_graph_context *ctx = data;
10451046
int i, count = 0;
10461047
struct commit **list = ctx->commits.list;
10471048

@@ -1066,8 +1067,9 @@ static int write_graph_chunk_fanout(struct hashfile *f,
10661067
}
10671068

10681069
static int write_graph_chunk_oids(struct hashfile *f,
1069-
struct write_commit_graph_context *ctx)
1070+
void *data)
10701071
{
1072+
struct write_commit_graph_context *ctx = data;
10711073
struct commit **list = ctx->commits.list;
10721074
int count;
10731075
for (count = 0; count < ctx->commits.nr; count++, list++) {
@@ -1085,8 +1087,9 @@ static const unsigned char *commit_to_sha1(size_t index, void *table)
10851087
}
10861088

10871089
static int write_graph_chunk_data(struct hashfile *f,
1088-
struct write_commit_graph_context *ctx)
1090+
void *data)
10891091
{
1092+
struct write_commit_graph_context *ctx = data;
10901093
struct commit **list = ctx->commits.list;
10911094
struct commit **last = ctx->commits.list + ctx->commits.nr;
10921095
uint32_t num_extra_edges = 0;
@@ -1187,8 +1190,9 @@ static int write_graph_chunk_data(struct hashfile *f,
11871190
}
11881191

11891192
static int write_graph_chunk_generation_data(struct hashfile *f,
1190-
struct write_commit_graph_context *ctx)
1193+
void *data)
11911194
{
1195+
struct write_commit_graph_context *ctx = data;
11921196
int i, num_generation_data_overflows = 0;
11931197

11941198
for (i = 0; i < ctx->commits.nr; i++) {
@@ -1208,8 +1212,9 @@ static int write_graph_chunk_generation_data(struct hashfile *f,
12081212
}
12091213

12101214
static int write_graph_chunk_generation_data_overflow(struct hashfile *f,
1211-
struct write_commit_graph_context *ctx)
1215+
void *data)
12121216
{
1217+
struct write_commit_graph_context *ctx = data;
12131218
int i;
12141219
for (i = 0; i < ctx->commits.nr; i++) {
12151220
struct commit *c = ctx->commits.list[i];
@@ -1226,8 +1231,9 @@ static int write_graph_chunk_generation_data_overflow(struct hashfile *f,
12261231
}
12271232

12281233
static int write_graph_chunk_extra_edges(struct hashfile *f,
1229-
struct write_commit_graph_context *ctx)
1234+
void *data)
12301235
{
1236+
struct write_commit_graph_context *ctx = data;
12311237
struct commit **list = ctx->commits.list;
12321238
struct commit **last = ctx->commits.list + ctx->commits.nr;
12331239
struct commit_list *parent;
@@ -1280,8 +1286,9 @@ static int write_graph_chunk_extra_edges(struct hashfile *f,
12801286
}
12811287

12821288
static int write_graph_chunk_bloom_indexes(struct hashfile *f,
1283-
struct write_commit_graph_context *ctx)
1289+
void *data)
12841290
{
1291+
struct write_commit_graph_context *ctx = data;
12851292
struct commit **list = ctx->commits.list;
12861293
struct commit **last = ctx->commits.list + ctx->commits.nr;
12871294
uint32_t cur_pos = 0;
@@ -1315,8 +1322,9 @@ static void trace2_bloom_filter_settings(struct write_commit_graph_context *ctx)
13151322
}
13161323

13171324
static int write_graph_chunk_bloom_data(struct hashfile *f,
1318-
struct write_commit_graph_context *ctx)
1325+
void *data)
13191326
{
1327+
struct write_commit_graph_context *ctx = data;
13201328
struct commit **list = ctx->commits.list;
13211329
struct commit **last = ctx->commits.list + ctx->commits.nr;
13221330

@@ -1737,8 +1745,9 @@ static int write_graph_chunk_base_1(struct hashfile *f,
17371745
}
17381746

17391747
static int write_graph_chunk_base(struct hashfile *f,
1740-
struct write_commit_graph_context *ctx)
1748+
void *data)
17411749
{
1750+
struct write_commit_graph_context *ctx = data;
17421751
int num = write_graph_chunk_base_1(f, ctx->new_base_graph);
17431752

17441753
if (num != ctx->num_commit_graphs_after - 1) {
@@ -1750,7 +1759,7 @@ static int write_graph_chunk_base(struct hashfile *f,
17501759
}
17511760

17521761
typedef int (*chunk_write_fn)(struct hashfile *f,
1753-
struct write_commit_graph_context *ctx);
1762+
void *data);
17541763

17551764
struct chunk_info {
17561765
uint32_t id;

0 commit comments

Comments
 (0)