summaryrefslogtreecommitdiff
path: root/source4/lib/talloc/talloc.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-20 05:03:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:35 -0500
commit545203d9154a9ce0f5cc3800796581f62380074b (patch)
tree1b086d811be998cd6df593b08ee2bfdbad5940e1 /source4/lib/talloc/talloc.h
parentdb6933323c0997cc6334d447e9a938cb42731ae9 (diff)
downloadsamba-545203d9154a9ce0f5cc3800796581f62380074b.tar.gz
samba-545203d9154a9ce0f5cc3800796581f62380074b.tar.bz2
samba-545203d9154a9ce0f5cc3800796581f62380074b.zip
r7778: added talloc_find_parent_bytype() and talloc_find_parent_byname()
These provide a way to find a parent of a ptr that is of a given type. I will be using this to find the event context in smbd, relying on the fact that everything is a child of the top level event context. I did look at the alternatives, and found that passing the event context to just about every call in smbd was getting way too complex (we need to get it to anything that can do a ldb operation, as that can invoke ldap). So this method avoids a global, and seems to work nicely (This used to be commit bdb55c7a10a516b75652065e14f5acd09d24ab35)
Diffstat (limited to 'source4/lib/talloc/talloc.h')
-rw-r--r--source4/lib/talloc/talloc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/source4/lib/talloc/talloc.h b/source4/lib/talloc/talloc.h
index ab549cf624..5160a3874a 100644
--- a/source4/lib/talloc/talloc.h
+++ b/source4/lib/talloc/talloc.h
@@ -65,6 +65,8 @@ typedef void TALLOC_CTX;
#define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type)
#define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type)
+#define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type)
+
#if TALLOC_DEPRECATED
#define talloc_zero_p(ctx, type) talloc_zero(ctx, type)
@@ -127,6 +129,7 @@ void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned
void *talloc_realloc_fn(const void *context, void *ptr, size_t size);
void *talloc_autofree_context(void);
size_t talloc_get_size(const void *ctx);
+void *talloc_find_parent_byname(const void *ctx, const char *name);
#endif