[PATCH 1/1] Add talloc_memdup_type

simo idra at samba.org
Fri Jul 4 15:47:05 GMT 2008


On Fri, 2008-07-04 at 10:57 +0100, Amin Azez wrote:
> talloc_memdup is all very fine, but is useless for cloning structs
> that are type-checked using talloc_get_type.
> 
> talloc_memdup_type is like talloc_memdup except it preserves the name
> on the new allocation

talloc_memdup is meant to copy just an anonymous region of memory.

I would call your new function talloc_dup() instead.
That would make it clear you are duplicating a full talloc context,
although I guess that may let people wonder if you also should become
parent (via references) of the original talloc context children or not.

This would have to be clearly documented.

Simo.

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



More information about the samba-technical mailing list