question about _talloc_free
Jeremy Allison
jra at samba.org
Tue Apr 14 00:19:24 GMT 2009
On Mon, Apr 13, 2009 at 04:00:05PM -0700, Herb Lewis wrote:
> in lib/talloc/talloc.c we have the following function defined
>
> static inline int _talloc_free(void *ptr)
>
> inside this function we have the following code
>
> if (unlikely(tc->refs)) {
> int is_child;
> /* check this is a reference from a child or grantchild
> * back to it's parent or grantparent
> *
> * in that case we need to remove the reference and
> * call another instance of talloc_free() on the current
> * pointer.
> */
> is_child = talloc_is_parent(tc->refs, ptr);
> _talloc_free(tc->refs);
> if (is_child) {
> return _talloc_free(ptr);
> }
> return -1;
> }
>
>
> First in the comments "grantchild" should be "grandchild"
Yup :-).
> Second, since _talloc_free is declared as inline, this generates a
> warning that it cannot be inlined when you call _talloc_free from
> inside the function.
Couldn't a clever compiler be able to do this ? Wouldn't it
be a push/call back to start of inline fn/pop call ? I can't see why
that can't be inlined.
Jeremy.
More information about the samba-technical
mailing list