Re: [PATCH v2 02/30] oid-array: teach oid-array to handle multiple kinds of oids
- From
- Linus Arver <linusa@google.com>
- Date
- Feb 17, 2024, 01:59 UTC
- Message-ID
- <owly8r3j97ge.fsf@fine.c.googlers.com>
- In-Reply-To
- <87le7lkoai.fsf@gmail.froward.int.ebiederm.org>
"Eric W. Biederman" <ebiederm@gmail.com> writes:
Show 25 quoted lines
> Linus Arver <linusa@google.com> 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.
Ah, yes. It appears that I simply read the code wrong. Thank you for the clarification, and I agree with your analysis and preferred style.
Sorry for the noise.