From 0a93af206c723be75de55db5d4da2e8d31a17c54 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Sep 2004 11:08:43 +0000 Subject: r2717: added talloc_p() docs (This used to be commit 6743ca1b1a24776559aa1c04f0f4a33c67cea8a7) --- talloc_guide.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'talloc_guide.txt') diff --git a/talloc_guide.txt b/talloc_guide.txt index 925f485997..ed3f7713aa 100644 --- a/talloc_guide.txt +++ b/talloc_guide.txt @@ -64,6 +64,19 @@ The context argument to talloc() can be NULL, in which case a new top level context is created. +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_p(const void *context, type); + +The talloc_p() macro is the equivalent of + + (type *)talloc(ctx, sizeof(type)) + +You should use it in preference to talloc() whenever possible, as it +provides additional type safety. It also automatically calls the +talloc_set_name_const() function with the name being a string holding +the name of the type. + + =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- int talloc_free(void *ptr); -- cgit