]> git.ipfire.org Git - thirdparty/git.git/commit
hash: add a function to look up hash algo structs
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 17 Nov 2025 22:16:12 +0000 (22:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Nov 2025 22:24:14 +0000 (14:24 -0800)
commiteae08d8bf7ee7b045371b5a64dc581e902703e58
tree19b2f7b13ae3cf2b0fcfabbc38aaf42a5e41283e
parent76ee08578ea6478015e7408f8376686d9f0411d6
hash: add a function to look up hash algo structs

In C, it's easy for us to look up a hash algorithm structure by its
offset by simply indexing the hash_algos array.  However, in Rust, we
sometimes need a pointer to pass to a C function, but we have our own
hash algorithm abstraction.

To get one from the other, let's provide a simple function that looks up
the C structure from the offset and expose it in Rust.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
hash.c
hash.h
src/hash.rs