Thread (2 messages) 2 messages, 2 authors, 2024-02-17

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

From: Eric W. Biederman <hidden>
Date: 2024-02-16 04:48:08

Linus Arver [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help