summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-03-16 10:16:40 +0100
committerStefan Metzmacher <metze@samba.org>2009-03-16 11:14:53 +0100
commit6d4a13241a096d30d37d69a8f7b888a395716316 (patch)
treed2fdd42dbd0cec26240a699ed495c9e01a6eb58c /lib/talloc
parenta3998832dbdbeb9ba5f3576a242bd48a5a3b3b60 (diff)
downloadsamba-6d4a13241a096d30d37d69a8f7b888a395716316.tar.gz
samba-6d4a13241a096d30d37d69a8f7b888a395716316.tar.bz2
samba-6d4a13241a096d30d37d69a8f7b888a395716316.zip
talloc: add useful talloc_array_length() macro
metze
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/talloc.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index 0defd4ab0e..5c8d5c5fe2 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -94,6 +94,7 @@ typedef void TALLOC_CTX;
#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__)
#define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count)
+#define talloc_array_length(ctx) ((ctx) ? talloc_get_size(ctx)/sizeof(*ctx) : 0)
#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type)
#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)