Import "talloc_array_length" from upstream talloc
authorVolker Lendecke <vl@samba.org>
Thu, 10 Dec 2009 12:02:29 +0000 (13:02 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 11 Dec 2009 23:45:39 +0000 (00:45 +0100)
lib/talloc/talloc.h

index 15130d0d9824743ad28fbe7c55c0fdbdfda2eb2b..bc50e5d315b231347275dad12fdfeba6d6defe31 100644 (file)
@@ -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) (talloc_get_size(ctx)/sizeof(*ctx))
 
 #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__)