Commit 3eac5e1
midx-write.c: reduce argument count for
The function `midx-write.c::get_sorted_entries()` is responsible for
constructing the array of OIDs from a given list of packs which will
comprise the MIDX being written.
The singular call-site for this function looks something like:
ctx.entries = get_sorted_entries(ctx.m, ctx.info, ctx.nr,
&ctx.entries_nr,
ctx.preferred_pack_idx);
This function has five formal arguments, all of which are members of the
shared `struct write_midx_context` used to track various pieces of
information about the MIDX being written.
The function `get_sorted_entries()` dates back to fe1ed56 (midx:
sort and deduplicate objects from packfiles, 2018-07-12), which came
shortly after 396f257 (multi-pack-index: read packfile list,
2018-07-12). The latter patch introduced the `pack_list` structure,
which was a precursor to the structure we now know as
`write_midx_context` (c.f. 577dc49 (midx: rename pack_info to
write_midx_context, 2021-02-18)).
At the time, `get_sorted_entries()` likely could have used the pack_list
structure introduced earlier in 396f257, but understandably did not
since the structure only contained three fields (only two of which were
relevant to `get_sorted_entries()`) at the time.
Simplify the declaration of this function by taking a single pointer to
the whole `struct write_midx_context` instead of various members within
it. Since this function is now computing the entire result (populating
both `ctx->entries`, and `ctx->entries_nr`), rename it to something that
doesn't start with "get_" to make clear that this function has a
side-effect.
Signed-off-by: Taylor Blau <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>get_sorted_entries()
1 parent 23532be commit 3eac5e1
1 file changed
+19
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 302 | + | |
307 | 303 | | |
308 | 304 | | |
309 | 305 | | |
310 | 306 | | |
311 | | - | |
312 | | - | |
| 307 | + | |
313 | 308 | | |
314 | | - | |
| 309 | + | |
315 | 310 | | |
316 | | - | |
| 311 | + | |
317 | 312 | | |
318 | 313 | | |
319 | 314 | | |
| |||
323 | 318 | | |
324 | 319 | | |
325 | 320 | | |
326 | | - | |
327 | | - | |
| 321 | + | |
| 322 | + | |
328 | 323 | | |
329 | 324 | | |
330 | 325 | | |
331 | 326 | | |
332 | | - | |
333 | | - | |
334 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
335 | 330 | | |
336 | | - | |
337 | | - | |
| 331 | + | |
| 332 | + | |
338 | 333 | | |
339 | | - | |
| 334 | + | |
340 | 335 | | |
341 | 336 | | |
342 | 337 | | |
343 | | - | |
344 | | - | |
345 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
346 | 341 | | |
347 | 342 | | |
348 | 343 | | |
| |||
356 | 351 | | |
357 | 352 | | |
358 | 353 | | |
359 | | - | |
| 354 | + | |
360 | 355 | | |
361 | | - | |
| 356 | + | |
362 | 357 | | |
363 | 358 | | |
364 | | - | |
| 359 | + | |
365 | 360 | | |
366 | 361 | | |
367 | 362 | | |
368 | 363 | | |
369 | | - | |
370 | 364 | | |
371 | 365 | | |
372 | 366 | | |
| |||
1054 | 1048 | | |
1055 | 1049 | | |
1056 | 1050 | | |
1057 | | - | |
1058 | | - | |
| 1051 | + | |
1059 | 1052 | | |
1060 | 1053 | | |
1061 | 1054 | | |
| |||
0 commit comments