summaryrefslogtreecommitdiff
path: root/split-index.h
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-03-20 16:02:40 -0400
committerJunio C Hamano <gitster@pobox.com>2023-03-20 14:40:13 -0700
commitf8762b1cefcdd8b027d1f89b0c37f9abe27b91c0 (patch)
treecb2c180235841d217d1ff0d82e57467aa84ca52b /split-index.h
parent73876f4861cd3d187a4682290ab75c9dccadbc56 (diff)
downloadgit-f8762b1cefcdd8b027d1f89b0c37f9abe27b91c0.tar.gz
pack-bitmap.c: hide bitmap internals in `read_u8()`
The `read_u8()` helper function internal to pack-bitmap.c was defined in b5007211b6 (pack-bitmap: do not use gcc packed attribute, 2014-11-27). Prior to b5007211b6, callers within pack-bitmap.c would read an individual unsigned integer by doing something like: struct bitmap_disk_entry *e; e = (struct bitmap_disk_entry *)(index->map + index->map_pos); index->map_pos += sizeof(*e); ...which relied on the fact that the `bitmap_disk_entry` struct was defined with `__attribute((packed))`, which b5007211b6 sought to get rid of since the `__attribute__` flag is a noop on some compilers (which makes the above code rely on the absence of padding to be correct). So b5007211b6 got rid of the above convention and replaced it by reading individual fields of that structure with a `read_u8()` helper that reads from the region of memory pointed to by `->map`, and updates the `->map_pos` pointer accordingly. But this forces callers to be intimately aware of `bitmap_git->map` and `bitmap_git->map_pos`. Instead, teach `read_u8()` to take a `struct bitmap_index *` directly, and avoid having callers deal with the internals themselves. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'split-index.h')
0 files changed, 0 insertions, 0 deletions