talloc context names

simo idra at samba.org
Thu Dec 29 08:54:41 MST 2011


On Thu, 2011-12-29 at 23:01 +1100, Andrew Bartlett wrote: 
> On Thu, 2011-12-29 at 03:33 +0000, simo wrote:
> > On Thu, 2011-12-29 at 01:12 +0100, Andrew Bartlett wrote:
> > > --- a/auth/kerberos/kerberos_pac.c
> > > +++ b/auth/kerberos/kerberos_pac.c
> > > @@ -77,7 +77,7 @@ krb5_error_code check_pac_checksum(TALLOC_CTX
> > > *mem_ctx,
> > >  *
> > >  * @return - A NTSTATUS error code
> > >  */
> > > -NTSTATUS kerberos_decode_pac(TALLOC_CTX *mem_ctx,
> > > +NTSTATUS kerberos_decode_pac(TALLOC_CTX *mem_ctx_out,
> > >                              DATA_BLOB pac_data_blob,
> > >                              krb5_context context,
> > >                              const krb5_keyblock *krbtgt_keyblock,
> > > @@ -109,13 +109,21 @@ NTSTATUS kerberos_decode_pac(TALLOC_CTX
> > > *mem_ctx,
> > >  
> > >         bool bool_ret;
> > >  
> > > -       *pac_data_out = NULL;
> > > +       TALLOC_CTX *mem_ctx = talloc_new(mem_ctx_out);
> > > +       if (!mem_ctx) {
> > > +               return NT_STATUS_NO_MEMORY;
> > > +       }
> > > + 
> > 
> > Andrew,
> > this may seem just a nitpick but I really find it utterly confusing to
> > change naming conventions for memory contexts in this way.
> > 
> > Why mem_ctx_out/mem_ctx instead of the customary mem_ctx/tmp_ctx ?
> 
> There was no good reason for this choice of name, so I'm currently
> autobuilding a series of patches to remove mem_ctx_out from the tree.  
> 
> There is of course more to do (like out_mem_ctx in a lot of the gensec
> code), but you are of course right to suggest the code should become
> more uniform, and changing variable names is an easy way to start on
> that.

Thanks,
that helps.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-technical mailing list