Re: [PATCH RFC 1/3] NFQUEUE: introduce CPU fanout

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

 



> >having read through the webpage - and using 'goto' for error handling
> >in own code quite often - I don't see why your code above should be
> >more readable.
> 
> It was only coincidental that the webpage also mentioned goto.
> The general idea (and google keywords) was called something like
> "Else Considered Harmful", and the lesson consisted of early
> exclusion of simple cases from the flow of the remainder of the
> function. Perhaps to illustrate it better:
> 
> 	list_for_each_entry(thing, &yourlist, anchor) {
> 		if (thing->property == MAGIC) {
> 			do_stuff;
> 		}
> 	}
> 
> =>
> 
> 	list_for_each_entry(thing, &yourlist, anchor) {
> 		if (thing->property != MAGIC)
> 			continue;
> 		do_stuff;
> 	}
> 
> Code may become more readable as one gains one level of indent and
> have some more freedom in arranging the giblets inside the do_stuff parts.

Ack.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux