[PATCH 2/6] pack-bitmap.c: hide bitmap internals in `read_be32()`
From: Taylor Blau <hidden>
Date: 2023-03-20 20:03:15
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Taylor Blau <hidden>
Date: 2023-03-20 20:03:15
Subsystem:
the rest · Maintainer:
Linus Torvalds
In a similar fashion as the previous commit, update `read_be32()` to take a `struct bitmap_index *` instead of copies of and pointers to variables within that structure. Signed-off-by: Taylor Blau <redacted> --- pack-bitmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pack-bitmap.c b/pack-bitmap.c
index d8ba252ba1..794aaf5b02 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c@@ -244,10 +244,10 @@ static struct stored_bitmap *store_bitmap(struct bitmap_index *index, return stored; } -static inline uint32_t read_be32(const unsigned char *buffer, size_t *pos) +static inline uint32_t read_be32(struct bitmap_index *bitmap_git) { - uint32_t result = get_be32(buffer + *pos); - (*pos) += sizeof(result); + uint32_t result = get_be32(bitmap_git->map + bitmap_git->map_pos); + bitmap_git->map_pos += sizeof(result); return result; }
@@ -282,7 +282,7 @@ static int load_bitmap_entries_v1(struct bitmap_index *index) if (index->map_size - index->map_pos < 6) return error(_("corrupt ewah bitmap: truncated header for entry %d"), i); - commit_idx_pos = read_be32(index->map, &index->map_pos); + commit_idx_pos = read_be32(index); xor_offset = read_u8(index); flags = read_u8(index);
--
2.40.0.77.gd564125b3f