[PATCH] fixes for ctdb/server/eventscript.c

Michael Adam obnox at samba.org
Fri Mar 13 09:33:33 MDT 2015


On 2015-03-13 at 16:25 +0100, Volker Lendecke wrote:
> On Fri, Mar 13, 2015 at 04:18:06PM +0100, Michael Adam wrote:
> > > +	for (i = 0; i < count; i++) {
> > 
> > I personally would prefer this as even better to read:
> > 
> > 	for (i = 0; i < scripts->num_scripts; i++)
> > 
> > but that's just my taste.
> 
> "count" denotes what came out of scandir, thus it is the array length
> for "namelist", the source of our copy operation. scripts->num_scripts
> denotes the number of scripts->scripts elements, the destination. Both
> are the same. From my pov both are really equivalent, but "count" has the
> advantage to generate less code. No pointer dereference. I know, this
> is so way beyond being measurable, but if both are really the *exact*
> same thing, I'd prefer the simpler one.
> 
> If you really want scripts->num_scripts, feel free :-)

Fair enough. My argument was more that for scripts->num_scripts I
have an immediate idea what is counted when looking at the for
loop, but of course they are equivalent and the optimization
convinces me. :)

> > > From 36232e0ec01a2617603a2f90903d8cdadb69bc81 Mon Sep 17 00:00:00 2001
> > > From: Volker Lendecke <vl at samba.org>
> > > Date: Fri, 13 Mar 2015 14:20:05 +0000
> > > Subject: [PATCH 5/5] ctdb: Fix 1125613 Destination buffer too small
> > 
> > What is 1125613 ? covetrity id?
> 
> Right. I forgot the "CID". Do you want me to add it and re-send?

I will add it and push.

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150313/dfbb205c/attachment-0001.pgp>


More information about the samba-technical mailing list