svn commit: samba r23283 - in branches/SAMBA_3_0/source/nsswitch: .

Michael Adam ma at sernet.de
Fri Jun 1 10:15:06 GMT 2007


Jeremy, please forget my last mail!

I overlooked the "subtlety" that talloc_move of course
takes a pointer to the arg passed to talloc_steal ... ;-/

I have changed it: r23287

Michael

On Fri, Jun 01, 2007 at 11:07:51AM +0200, Michael Adam wrote:
> On Thu, May 31, 2007 at 08:41:14PM -0700, Jeremy Allison wrote:
> > On Thu, May 31, 2007 at 11:55:40PM +0000, obnox at samba.org wrote:
> > > Author: obnox
> > > Date: 2007-05-31 23:55:37 +0000 (Thu, 31 May 2007)
> > > New Revision: 23283
> > > 
> > > WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23283
> > > 
> > > Log:
> > > Use a temporary talloc context in ads:lookup_groupmem. 
> > > And clean up unused stuff at the end.
> > > Daringly, I use talloc_steal at some point, where it 
> > > appears natural to me.
> > 
> > Rather than using talloc_steal() here :
> > 
> > (*names)[*num_names] = talloc_steal(names, names_nocache[i]);
> > 
> > please talloc_move() instead, as that's what you're
> > actually doing.
> > 
> > It should look like :
> > 
> > (*names)[*num_names] = talloc_move(tmp_ctx, &names_nocache[i]);
> > 
> > as you should no longer be accessing names_nocache[i] after
> > the move.
> 
> Hi Jeremy, 
> 
> this is what I did first, as it thought it best suited.
> But it gives me compile warnings:
> 
> Compiling nsswitch/winbindd_ads.c
> nsswitch/winbindd_ads.c: In function `lookup_groupmem':
> nsswitch/winbindd_ads.c:1057: warning: cast from pointer to integer of different size
> nsswitch/winbindd_ads.c:1057: warning: assignment makes pointer from integer without a cast
> 
> An so I fell back to talloc_steal.
> Are you telling me that this is not harmful?
> 
> Maybe the talloc_move macro should be extended to look like the
> talloc_steal macro? Some extended casting is performed in talloc_steal:
> 
> #define talloc_steal(ctx, ptr) ({ \
> 	_TALLOC_TYPEOF(ptr) __talloc_steal_ret = \
> 		(_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)); \
> 	__talloc_steal_ret; \
> })
> 
> vs.
> 
> #define talloc_move(ctx, ptr) ( \
> 	_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr) \
> )
> 
> (I added some whitespace and "\" here)
> 
> Cheers, Michael

-- 
Michael Adam <ma at sernet.de>
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: Info @ SerNet.DE


More information about the samba-technical mailing list