]> git.ipfire.org Git - thirdparty/git.git/commitdiff
midx: mark `get_midx_checksum()` arguments as const
authorTaylor Blau <me@ttaylorr.com>
Tue, 24 Feb 2026 18:59:34 +0000 (13:59 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Feb 2026 19:16:31 +0000 (11:16 -0800)
To make clear that the function `get_midx_checksum()` does not do
anything to modify its argument, mark the MIDX pointer as const.

The following commit will rename this function altogether to make clear
that it returns the raw bytes of the checksum, not a hex-encoded copy of
it.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c
midx.h

diff --git a/midx.c b/midx.c
index a75ea99a0d4bb052076c27f9c420ccecf3d053e0..2a6b18954c51fba43e6d05a82b282a124bf2bf4a 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -24,7 +24,7 @@ void clear_incremental_midx_files_ext(struct odb_source *source, const char *ext
 int cmp_idx_or_pack_name(const char *idx_or_pack_name,
                         const char *idx_name);
 
-const unsigned char *get_midx_checksum(struct multi_pack_index *m)
+const unsigned char *get_midx_checksum(const struct multi_pack_index *m)
 {
        return m->data + m->data_len - m->source->odb->repo->hash_algo->rawsz;
 }
diff --git a/midx.h b/midx.h
index 6e54d73503d56088923ceff1c69e1f8d6013ac12..7c7e0b5912151b46455e386baa78418f20f26c4f 100644 (file)
--- a/midx.h
+++ b/midx.h
@@ -85,7 +85,7 @@ struct multi_pack_index {
 #define MIDX_EXT_BITMAP "bitmap"
 #define MIDX_EXT_MIDX "midx"
 
-const unsigned char *get_midx_checksum(struct multi_pack_index *m);
+const unsigned char *get_midx_checksum(const struct multi_pack_index *m);
 void get_midx_filename(struct odb_source *source, struct strbuf *out);
 void get_midx_filename_ext(struct odb_source *source, struct strbuf *out,
                           const unsigned char *hash, const char *ext);