talloc
Simo Sorce
idra at samba.org
Sat Jul 13 09:07:02 GMT 2002
any objection into adding a function to talloc to import a previously
allocated memory?
something like that:
bool talloc_memorize(TALLOC_CTX *t, void *src, size_t src_size)
{
struct talloc_chunk *tc;
if (!t || !src || !src_size) return false;
tc = malloc(sizeof(*tc));
if (tc) {
tc->ptr = src;
tc->size = src_size;
tc->next = t->list;
t->list = tc;
t->total_alloc_size += src_size;
} else {
return false;
}
return true;
}
it would be useful to add allocated strings returned from another
function to a talloc context ... the only problem I see is the size one.
Simo.
--
Simo Sorce
----------
Una scelta di liberta': Software Libero.
A choice of freedom: Free Software.
http://www.softwarelibero.it
More information about the samba-technical
mailing list