[PATCH] pidl: Fix python generated code

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Jun 20 15:11:14 UTC 2017


On Tue, Jun 20, 2017 at 09:49:06AM -0400, jim via samba-technical wrote:
> Why not change the comparison to "<=" from "<" and avoid the "+1" change?
> 
> On 6/20/2017 9:36 AM, Volker Lendecke via samba-technical wrote:
> >-	$self->pidl("if (ndr_table_$iface\.num_calls < $fn->{OPNUM}) {");
> >+	$self->pidl("if (ndr_table_$iface\.num_calls < " . ($fn->{OPNUM}+1) .
> >+		    ") {");

To me the array bounds check with the "<" easier to understand, but
that's a matter of taste. If someone stronly feels about it, I'm fine
with <= too of course. With any sane compiler it should not make any
difference in generated code.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de



More information about the samba-technical mailing list