You should read&nbsp;<a href="http://kerneltrap.org/node/553/2131">http://kerneltrap.org/node/553/2131</a><div><br></div><div><div>There&#39;s plenty of cases where goto is justified and certainly branching out into error conditions is one of them. &nbsp;At least on the intel architecture goto typically translates 1:1 to the jmp instruction and is monumentally more efficient than constructing complex and hard to understand loops.</div>
<div><br></div><div>-Daniel</div><div><br></div><div><div class="gmail_quote">On Tue, Jan 27, 2009 at 12:54 PM, Johansson Olle E <span dir="ltr">&lt;<a href="mailto:oej@edvina.net">oej@edvina.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi!<br>
<br>
I&#39;ve been spending some time going through the mi_* modules for<br>
doxygen and other format changes, as well as checking spelling of log<br>
messages and docs.<br>
<br>
I see a lot of code with goto&#39;s that isn&#39;t needed and can be changed.<br>
Most common is &quot;goto error&quot; where error just is one line that returns<br>
an error code. This can simply be changed so that the &quot;goto error&quot; is<br>
replaced with &quot;return &lt;errorcode&gt;;&quot;<br>
<br>
I don&#39;t know your code guidelines, but this code would not be approved<br>
in Asterisk. We&#39;re trying to simplify code paths as much as possible<br>
to make things easier to understand and follow. Overuse of goto<br>
doesn&#39;t make code easy to read, in my opinion...<br>
<br>
What do you think?<br>
<br>
/O<br>
<br>
<br>
PS: Fixing code is a good way for me to learn how Kamailio works on<br>
the inside :-)<br>
<br>
<br>
_______________________________________________<br>
Kamailio (OpenSER) - Devel mailing list<br>
<a href="mailto:Devel@lists.kamailio.org">Devel@lists.kamailio.org</a><br>
<a href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel" target="_blank">http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel</a><br>
<a href="http://lists.openser-project.org/cgi-bin/mailman/listinfo/devel" target="_blank">http://lists.openser-project.org/cgi-bin/mailman/listinfo/devel</a><br>
</blockquote></div><br></div></div>