talloc_array_length: talloc_get_size deals fine with NULL
authorVolker Lendecke <vl@samba.org>
Sun, 22 Mar 2009 21:07:58 +0000 (22:07 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 22 Mar 2009 21:10:09 +0000 (22:10 +0100)
lib/talloc/talloc.h

index 5c8d5c5fe2c05ae19543d889df66dd61685a4080..f87564a13bf23e450b8e7bf49eb125e2bd4a4788 100644 (file)
@@ -94,7 +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_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__)