1 May 2009 02:19
Re: [PATCH] Change unix_convert to use struct smb_filename
Jeremy Allison <jra <at> samba.org>
2009-05-01 00:19:00 GMT
2009-05-01 00:19:00 GMT
On Thu, Apr 30, 2009 at 12:02:32PM -0700, Tim Prouty wrote: > > Thanks for the feedback! > > I was considering that option, but since we already had a talloc_ctx > being passed around, it seemed simpler to just have the smb_filename > struct sit on the stack. I guess one possible advantage of tallocing an > smb_filename struct is that the talloc_ctx arg could be eliminated from > unix_convert, further simplifying the API. Actually you can't do that as you sometimes might want to talloc one *not* on talloc_tos() (which I'm assuming you were intending using instead - using the NULL context is not recommended). So you still need the talloc_ctx argument to unix_convert() even in the talloc'ed struct smb_filename returned case. > Another advantage is that the memory would be more cleanly tracked, and > could be freed earlier as soon as it is no longer being used. Are there > other advantages as well? > > On a related note, in a future patch it would make sense to store the > smb_filename struct in the file_struct as well. To add this ability > I'll probably also add some utility functions that alloc/init/copy/etc > smb_filename structs. These utility structs could be used here as well. Ok, I went over this patch and I really like it (although it won't apply with git am to master anymore(Continue reading). I agree with Volker. unix_convert should return a talloc'ed
.
I agree with Volker. unix_convert should return a talloc'ed
RSS Feed