pack-objects: widen `mem_usage` and `try_delta()`'s out-param to `size_t`

The pair must move together because `find_deltas()` passes `&mem_usage` to `try_delta()`: widening either alone breaks the type match. `mem_usage` accumulates per-object byte counts already computed in `size_t` (`SIZE()` and `sizeof_delta_index()` reach here through `free_unpacked()`, now `size_t`), and was the last 32-bit-on-Windows narrowing point in the delta-window memory accounting chain. With this commit, that chain uses `size_t` consistently except for `sizeof_delta_index()`'s still-narrow return, whose value is bounded by `create_delta_index()`'s entries cap. `window_memory_limit` (config-driven via `git_config_ulong()`) stays `unsigned long`: it is only compared against `mem_usage` and promotes. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jul 9, 2026 at 16:49 UTC 161889b4c8d04cd91dd8524ffe8c79c3575d930b
1 file changed +2 -2
builtin/pack-objects.c
+2 -2
@@ -2787,7 +2787,7 @@ size_t oe_get_size_slow(struct packing_data *pack,
2787 }
2788
2789 static int try_delta(struct unpacked *trg, struct unpacked *src,
2790 - unsigned max_depth, unsigned long *mem_usage)
2790 + unsigned max_depth, size_t *mem_usage)
2791 {
2792 struct object_entry *trg_entry = trg->entry;
2793 struct object_entry *src_entry = src->entry;
@@ -2974,7 +2974,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
2974 {
2975 uint32_t i, idx = 0, count = 0;
2976 struct unpacked *array;
2977 - unsigned long mem_usage = 0;
2977 + size_t mem_usage = 0;
2978
2979 CALLOC_ARRAY(array, window);
2980