From: Patrick Steinhardt Date: Tue, 09 Dec 2025 06:27:49 GMT Subject: Re: [PATCH 02/17] midx: split `get_midx_checksum()` by adding `get_midx_hash()` Message-ID: In-Reply-To: On Mon, Dec 08, 2025 at 08:50:08PM -0500, Taylor Blau wrote: > On Mon, Dec 08, 2025 at 08:42:23PM -0500, Taylor Blau wrote: > > On Mon, Dec 08, 2025 at 07:25:05PM +0100, Patrick Steinhardt wrote: > > > If I didn't have the context of this patch series I would be wondering > > > what the actual difference between `get_midx_checksum()` and > > > `get_midx_hash()` is. The way the functions are named seems to rather > > > indicate that we talk about two different kinds of hashes, rather than > > > two different ways to encode them. > > > > > > Would it maybe be preferable to call them `get_midx_checksum()` and > > > `get_midx_checksum_hex()`? While at it, we could go even further and > > > rename them to `midx_get_checksum()` and `midx_get_checksum_hex()` to > > > conform to our modern best practices. > > > > Yeah, I think those are both reasonable suggestions; I'll apply those > > locally, thanks! > > Hmm. Upon further thinking, I wonder which function should be named > which. > > I think the _checksum() variant suggests that it returns the non-hex > encoded form, while the _hex() variant suggests the opposite. > Unfortunately, the latter is both more commonly used and more characters > to type ;-). > > I wonder if there are shorter names available. Perhaps > midx_get_checksum() and midx_get_checksum_raw()? It's only four more characters to type the `_hex()` variant, and it is in line with the interfaces we've got in "hex.h". So personally I'd still prefer to go with `_hex()`. Patrick