r20242?

tridge at samba.org tridge at samba.org
Wed Dec 20 03:03:10 GMT 2006


Alexander,

 > In this case allocating a structure off of context is changing user data.

no it isn't. If you allocate N bytes with talloc and get a pointer 'p'
then the only bytes that are user data are p[0..N-1]. 

The hierarchy that talloc offers is 'magic' from the point of view of
callers. It doesn't matter how that is implemented, and it is the job
of talloc.c to make sure it works on every architecture without
violating any assumptions the compiler makes. 

Unless a byte is changing inside the range p[0..N-1] then the user
data has not changed, and the pointer can be const.

Cheers, Tridge


More information about the samba-technical mailing list