util: Add dedicated hex conversion functions and use it.
authorTatsuyuki Ishi <ishitatsuyuki@gmail.com>
Mon, 17 Apr 2023 13:08:24 +0000 (22:08 +0900)
committerMarge Bot <emma+marge@anholt.net>
Wed, 19 Apr 2023 04:19:50 +0000 (04:19 +0000)
commit681d8cd9ea9e5d8b0e4974e181614dff0f45328e
tree48dbbde05dc7b9489ddd10d6d1d4cc9de5a49de5
parent96a0b1e9880cee88905fe45451404e0d3120f382
util: Add dedicated hex conversion functions and use it.

This deduplicate two identical bytes_to_hex implementation into one.

The intention is to ease the introduction of a new hash algorithm, which
will also have its formatting helper (to ensure seamless transition from
sha1).

Note that the new functions always take the size of the binary buffer,
unlike the old disk_cache_format_hex_id which took `binary * 2` which was
inconsistent (binary size is `binary` and string size is `binary * 2 + 1`).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22527>
src/util/disk_cache.h
src/util/hex.h [new file with mode: 0644]
src/util/mesa-sha1.c
src/util/meson.build