svn commit: samba r1892 - branches/SAMBA_4_0/source/lib

tridge at samba.org tridge at samba.org
Wed Aug 18 18:25:02 GMT 2004


Author: tridge
Date: 2004-08-18 18:25:02 +0000 (Wed, 18 Aug 2004)
New Revision: 1892

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1892&nolog=1

Log:
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. 


Modified:
   branches/SAMBA_4_0/source/lib/talloc.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/talloc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc.c	2004-08-18 17:56:50 UTC (rev 1891)
+++ branches/SAMBA_4_0/source/lib/talloc.c	2004-08-18 18:25:02 UTC (rev 1892)
@@ -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 at samba.org>
    
    This program is free software; you can redistribute it and/or modify
@@ -152,6 +152,18 @@
 }
 
 
+/*
+  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)
 {



More information about the samba-cvs mailing list