tech-net archive

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

Re: Plan for improving IP_PKTINFO socket option handling



On Jan 1,  9:40am, tih%hamartun.priv.no@localhost (Tom Ivar Helbekkmo) wrote:
-- Subject: Re: Plan for improving IP_PKTINFO socket option handling

| Christos Zoulas <christos%astron.com@localhost> writes:
| 
| > This came up in a different discussion; we should pass the size around...
| 
| Thanks for fixing that -- and for committings my IP_PKTINFO changes!  I
| liked the little adjustments you made to the code, there.  It does get
| more readable with the reduced nesting and early resolution tweaks.

Well, you did most of the work (even for getsockopt) :-)

| Where can I find official guidelines for coding style?

There is /usr/share/misc/style but it is outdated. It also does
not mention the preference for the "early returns" style. The
typical example here is:

	if (foo) {
		bar;
	} else {
		/* long code sequence */
	}
	return | break;

to:
	if (foo) {
		bar;
		return | break;
	}
	/* long code sequence */
	return | break;

Sometimes it is worth moving the code in a function to be able to do
"early returns", when there are many return points that do "cleanup",
instead of "goto out".

| When we're sure the passing of the buffer size down from getsockopt(2)
| is good, we should adjust the bit that handles getting the IP_PKTINFO
| option data: the comments are no longer correct, at least.

I will fix that, thanks!

Happy New Year,

christos


Home | Main Index | Thread Index | Old Index