From c287cc247d90c996894cab18e870c992e7f84f85 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 6 Mar 2006 00:24:51 +0000 Subject: r13851: More doc improvements. (This used to be commit 936d26ae64b93ef8f8b2fbc632b1c2fd60840405) --- source4/lib/util/util.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source4/lib/util/util.h') diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h index 272cc13f4e..1dfd942dd3 100644 --- a/source4/lib/util/util.h +++ b/source4/lib/util/util.h @@ -100,8 +100,20 @@ struct substitute_context; #define SAFE_FREE(x) do { if ((x) != NULL) {free(discard_const_p(void *, (x))); (x)=NULL;} } while(0) #endif +/** + * Type-safe version of malloc. Allocated one copy of the + * specified data type. + */ #define malloc_p(type) (type *)malloc(sizeof(type)) + +/** + * Allocate an array of elements of one data type. Does type-checking. + */ #define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count) + +/** + * Resize an array of elements of one data type. Does type-checking. + */ #define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count) #if defined(VALGRIND) @@ -127,6 +139,8 @@ struct substitute_context; makes the return type safe. */ #define discard_const(ptr) ((void *)((intptr_t)(ptr))) + +/** Type-safe version of discard_const */ #define discard_const_p(type, ptr) ((type *)discard_const(ptr)) #endif /* _SAMBA_UTIL_H_ */ -- cgit