Thread (13 messages) 13 messages, 2 authors, 2024-07-31

Re: [PATCH v1 net-next 2/6] net: Don't register pernet_operations if only one of id or size is specified.

From: Kuniyuki Iwashima <hidden>
Date: 2024-07-31 18:44:08

From: Jakub Kicinski <kuba@kernel.org>
Date: Tue, 30 Jul 2024 18:54:12 -0700
On Mon, 29 Jul 2024 14:07:57 -0700 Kuniyuki Iwashima wrote:
quoted
+	if (WARN_ON((ops->id && !ops->size) || (!ops->id && ops->size)))
I'd write as:

	if (WARN_ON(!!ops->id != !!ops->size))

or

	if (WARN_ON(!!ops->id ^ !!ops->size))

but not 100% sure if it's idiomatic or just my preference..
Actually I wrote the latter first so will use it in v2.
Just not confident about which was easier to read.

Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help