diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-03-06 00:24:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:52:16 -0500 |
commit | c287cc247d90c996894cab18e870c992e7f84f85 (patch) | |
tree | 01bcabc38219d24c75b4ba494eed2b4e475f7f2a /source4/lib/util/util.h | |
parent | 77ffddec1911ac5de3a96a36c9476dce6e67f4f4 (diff) | |
download | samba-c287cc247d90c996894cab18e870c992e7f84f85.tar.gz samba-c287cc247d90c996894cab18e870c992e7f84f85.tar.xz samba-c287cc247d90c996894cab18e870c992e7f84f85.zip |
r13851: More doc improvements.
(This used to be commit 936d26ae64b93ef8f8b2fbc632b1c2fd60840405)
Diffstat (limited to 'source4/lib/util/util.h')
-rw-r--r-- | source4/lib/util/util.h | 14 |
1 files changed, 14 insertions, 0 deletions
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_ */ |