diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-08-18 18:25:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:08 -0500 |
commit | c3a2584bb485e41d580e4098731984c194602fc8 (patch) | |
tree | 8bc65b8133df6ea32230041530f7836595d1851b /source4/lib | |
parent | 6e5a9a6fe4368748dae0c26bb7a019d848621e66 (diff) | |
download | samba-c3a2584bb485e41d580e4098731984c194602fc8.tar.gz samba-c3a2584bb485e41d580e4098731984c194602fc8.tar.bz2 samba-c3a2584bb485e41d580e4098731984c194602fc8.zip |
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)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/talloc.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c index 421a09e3c6..328a1ce1d1 100644 --- a/source4/lib/talloc.c +++ b/source4/lib/talloc.c @@ -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) { |