Subject: Re: [PATCH v2 02/30] oid-array: teach oid-array to handle multiple kinds of oids

From: "Eric W. Biederman" <[email-masked]>
Date: Thu, 15 Feb 2024 22:48:05 -0600

Linus Arver <[email-masked]> writes:

>
> I would still prefer the "early return for errors" style even in this
> case. This is because I much prefer to have the question "how can things
> go wrong?" answered first, and dealt with, such that as I read
> top-to-bottom I am left with less things I have to consider to
> understand the "happy path". WRT emphasizing the "algos equal each
> other" concern, a simple comment like

void_hashcmp is a function that reports how two elements are ordered.
There is no error handling.

There are in fact two cases that need to be handled with oid_array being
able to contain more then one kind of hash at a time.

The two entries are ordered by oidcmp.
The two entries are ordered by hash algorithm.

The order that is maintained is first everything is ordered by hash
algorithm, then for entries of identical hash algorithm they are ordered
by oidcmp.

So I don't think the concept of early return for errors can ever apply
to any version of void_hashcmp.

Eric