r2717: added talloc_p() docs
[bbaumbach/samba-autobuild/.git] / 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);