Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/kern

Hi Tyler,

On Sat, May 02, 2015 at 11:46:05PM +0000, Tyler R. Retzlaff wrote:
> Module Name:	src
> Committed By:	rtr
> Date:		Sat May  2 23:46:04 UTC 2015
> Modified Files:
> 	src/sys/kern: uipc_socket.c
> Log Message:
> compare mbuf * pointer to NULL instead of 0

> @@ -941,7 +941,7 @@ sosend(struct socket *so, struct mbuf *a
>  					error = ENOTCONN;
>  					goto release;
>  				}
> -			} else if (addr == 0) {
> +			} else if (NULL == addr) {

I really appreciate what you're doing with the mbuf conversion work. 

Having said that, I absolutely loathe the "NULL == addr" style of
writing comparisons - it was introduced when compilers were stupid
enough to think that a mistyped "var = value" could be misinterpreted
as a conditional statement like "var == value".  That hasn't
been the case for a long while.  Semantically it's ass backwards, it
doesn't follow the conventions that the other comparisons in this file
make, and it's ugly, and I now have to parse the individual operation,
rather than reading the code as a whole :-(.

Anyway, please don't get me wrong, I really like the movement away
from mbufs in the networking code, it's good - just don't see the
point in using this unconventional way of expressing conditionals.


Home | Main Index | Thread Index | Old Index