diff options
| author | Taylor Blau <me@ttaylorr.com> | 2024-05-23 17:26:49 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-24 11:40:42 -0700 |
| commit | 79621f3e4151dfe8ef8fdb2800c59dc65f4867e6 (patch) | |
| tree | 0c6158909e11f21f57c2cb17b2b606b07f847009 /pack-bitmap.h | |
| parent | 53ea3ec47990e9ad00a238fd962f36e5d87a6386 (diff) | |
pack-bitmap: extract `read_bitmap()` function
The pack-bitmap machinery uses the `read_bitmap_1()` function to read a
bitmap from within the mmap'd region corresponding to the .bitmap file.
As as side-effect of calling this function, `read_bitmap_1()` increments
the `index->map_pos` variable to reflect the number of bytes read.
Extract the core of this routine to a separate function (that operates
over a `const unsigned char *`, a `size_t` and a `size_t *` pointer)
instead of a `struct bitmap_index *` pointer.
This function (called `read_bitmap()`) is part of the pack-bitmap.h API
so that it can be used within the upcoming portion of the implementation
in pseduo-merge.ch.
Rewrite the existing function, `read_bitmap_1()`, in terms of its more
generic counterpart.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap.h')
| -rw-r--r-- | pack-bitmap.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pack-bitmap.h b/pack-bitmap.h index db9ae554fa..21aabf805e 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -160,4 +160,6 @@ int bitmap_is_preferred_refname(struct repository *r, const char *refname); int verify_bitmap_files(struct repository *r); +struct ewah_bitmap *read_bitmap(const unsigned char *map, + size_t map_size, size_t *map_pos); #endif |
