r20242?
Alexander Bokovoy
ab at samba.org
Wed Dec 20 06:16:50 GMT 2006
Tridge,
tridge at samba.org wrote:
> 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.
This is not what I'm talking about. If hierarhy is used within
application then allocating something in a context is effectifely
changing that hierarchy, hence changing user data (of which this
hierarchy is a part).
Of course, you could argue that a developer would probably be better by
adding linked list to the structure itself and managing it explicitly
but if talloc already provides this resource, why can't it be used?
--
/ Alexander Bokovoy
Samba Team http://www.samba.org/
ALT Linux Team http://www.altlinux.org/
Midgard Project Ry http://www.midgard-project.org/
More information about the samba-technical
mailing list