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

Simon Kelley simon at thekelleys.org.uk
Thu Feb 1 21:09:42 GMT 2007


Jan 'RedBully' Seiffert wrote:
> 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.

Looks good to me, applied with only minor changes.

> Only compile tested, and... be carefull, was at the dentist today, lost
> 2 wisdom theeth, so...

Ow, ow. I still have mine, and I hope to keep it that way.

Cheers,

Simon.

> 



More information about the Dnsmasq-discuss mailing list