]> git.ipfire.org Git - thirdparty/git.git/commitdiff
diff-delta: widen `struct delta_index`' size fields to `size_t`
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 9 Jul 2026 16:49:28 +0000 (16:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Jul 2026 21:55:23 +0000 (14:55 -0700)
Preparation for widening the delta-encoding API to `size_t` in
subsequent commits, which is what lets pack-objects drop the
`cast_size_t_to_ulong()` shims that 606c192380 (odb, packfile: use
size_t for streaming object sizes, 2026-05-08) had to leave behind in
`get_delta()` and `try_delta()` because their downstream consumers were
still narrow.

The struct is private to diff-delta.c, so widening its fields in
isolation is a no-op at runtime: the values stored continue to fit in 32
bits on Windows because the public API around it still truncates.
Splitting it out keeps the API-change commit focused on caller updates.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-delta.c

index 43c339f01061ca83e3273061fbe9fd621125b153..b6b65d76078030e687f858ef407d033cc9924baf 100644 (file)
@@ -125,9 +125,9 @@ struct unpacked_index_entry {
 };
 
 struct delta_index {
-       unsigned long memsize;
+       size_t memsize;
        const void *src_buf;
-       unsigned long src_size;
+       size_t src_size;
        unsigned int hash_mask;
        struct index_entry *hash[FLEX_ARRAY];
 };
@@ -140,7 +140,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
        struct unpacked_index_entry *entry, **hash;
        struct index_entry *packed_entry, **packed_hash;
        void *mem;
-       unsigned long memsize;
+       size_t memsize;
 
        if (!buf || !bufsize)
                return NULL;