[Dnsmasq-discuss] goto's to the middle of if's in tftp.c...

Jan 'RedBully' Seiffert redbully at cc.fh-luh.de
Thu Feb 1 19:21:23 GMT 2007


Simon Kelley wrote:
> Carlos Carvalho wrote:
>> There are some goto's to the middle of if's and else's in tftp.c. Such
>> jumps could perhaps be changed to a place less susceptible to
>> confusion... Since it's a new piece of code it might still be open to
>> small revisions. It may cost some extra if's but it won't make a
>> difference in performance.
> 
> If anyone can come up with a nicer solution, I'd be happy to take it,
> but I think that's a good use for gotos. The code identifies a couple of
> error conditions and the way to handle them, so it's obvious what's
> going on. When the same error conditions are encountered later, they are
> handled by gotos to the previously defined error handling code - it's a
> standard programming practise.
> 
I also "like" to handle such error cascades with gotos.
But maybe with another subfunction (so other checks could be cleanly
added) and only jumping forward is a little cleaner. So hear goes my
suggestion.
Only compile tested, and... be carefull, was at the dentist today, lost
2 wisdom theeth, so...

> Cheers,
> 
> Simon.
> 
Greetings
	Jan


-- 
public enum BOOL
{
  TRUE,
  FALSE,
  NOT_TRUE_OR_FALSE
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dnsmasq-2.36-rearange.diff
Type: text/x-patch
Size: 6107 bytes
Desc: not available
Url : http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20070201/c8364d2c/dnsmasq-2.36-rearange.bin


More information about the Dnsmasq-discuss mailing list