1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

r1892: this adds talloc_get_context(), which is something I discussed at the

team meeting at CIFS04. It allows you to find the talloc context given
any pointer allocated with talloc.
(This used to be commit 01dc4ed9b4f9390930d3c235cf2ccf9a9028392d)
This commit is contained in:
Andrew Tridgell 2004-08-18 18:25:02 +00:00 committed by Gerald (Jerry) Carter
parent 6e5a9a6fe4
commit c3a2584bb4

View File

@ -1,7 +1,7 @@
/*
Samba Unix SMB/CIFS implementation.
Samba temporary memory allocation functions
Copyright (C) Andrew Tridgell 2000
Copyright (C) Andrew Tridgell 2000-2004
Copyright (C) 2001, 2002 by Martin Pool <mbp@samba.org>
This program is free software; you can redistribute it and/or modify
@ -152,6 +152,18 @@ static TALLOC_CTX *talloc_init_internal(void)
}
/*
return the talloc context given a pointer that has been allocated using
talloc
*/
TALLOC_CTX *talloc_get_context(void *ptr)
{
struct talloc_chunk *tc;
tc = ((struct talloc_chunk *)ptr)-1;
return tc->context;
}
/** Allocate a bit of memory from the specified pool **/
void *talloc(TALLOC_CTX *t, size_t size)
{