[Kamailio-Devel] Use of goto

Johansson Olle E oej at edvina.net
Tue Jan 27 21:54:55 CET 2009


Hi!

I've been spending some time going through the mi_* modules for  
doxygen and other format changes, as well as checking spelling of log  
messages and docs.

I see a lot of code with goto's that isn't needed and can be changed.  
Most common is "goto error" where error just is one line that returns  
an error code. This can simply be changed so that the "goto error" is  
replaced with "return <errorcode>;"

I don't know your code guidelines, but this code would not be approved  
in Asterisk. We're trying to simplify code paths as much as possible  
to make things easier to understand and follow. Overuse of goto  
doesn't make code easy to read, in my opinion...

What do you think?

/O


PS: Fixing code is a good way for me to learn how Kamailio works on  
the inside :-)




More information about the Devel mailing list