r2717: added talloc_p() docs
authorAndrew Tridgell <tridge@samba.org>
Tue, 28 Sep 2004 11:08:43 +0000 (11:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:25 +0000 (12:59 -0500)
talloc_guide.txt

index 925f485997e90abfce647f660566d289f490aee0..ed3f7713aa7c64790d058face042160c0d965539 100644 (file)
@@ -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);