From b664a86bc2a1f4f0d6f7fb32caf744effa96bdf4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Dec 2009 13:02:29 +0100 Subject: [PATCH] Import "talloc_array_length" from upstream talloc (This used to be ctdb commit 844aa6300ee4d87561e698001ebc15ac1e455528) --- ctdb/lib/talloc/talloc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ctdb/lib/talloc/talloc.h b/ctdb/lib/talloc/talloc.h index 15130d0d982..bc50e5d315b 100644 --- a/ctdb/lib/talloc/talloc.h +++ b/ctdb/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) (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__)