From: Linus Arver Date: Sat, 17 Feb 2024 01:59:29 GMT Subject: Re: [PATCH v2 02/30] oid-array: teach oid-array to handle multiple kinds of oids Message-ID: In-Reply-To: <87le7lkoai.fsf@gmail.froward.int.ebiederm.org> "Eric W. Biederman" writes: > Linus Arver 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.