From 8459391e31079066745a65c5f3c07f3899afdc0c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:03:16 +1000 Subject: s3-talloc Remove unused TALLOC zeronull functions and macro definitions These have been under #if 0 for a long time now. Andrew Bartlett --- source3/lib/util.c | 105 ----------------------------------------------------- 1 file changed, 105 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index a596385bfb..5aad243593 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2140,111 +2140,6 @@ void split_domain_user(TALLOC_CTX *mem_ctx, } } -#if 0 - -Disable these now we have checked all code paths and ensured -NULL returns on zero request. JRA. - -/**************************************************************** - talloc wrapper functions that guarentee a null pointer return - if size == 0. -****************************************************************/ - -#ifndef MAX_TALLOC_SIZE -#define MAX_TALLOC_SIZE 0x10000000 -#endif - -/* - * talloc and zero memory. - * - returns NULL if size is zero. - */ - -void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name) -{ - void *p; - - if (size == 0) { - return NULL; - } - - p = talloc_named_const(ctx, size, name); - - if (p) { - memset(p, '\0', size); - } - - return p; -} - -/* - * memdup with a talloc. - * - returns NULL if size is zero. - */ - -void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name) -{ - void *newp; - - if (size == 0) { - return NULL; - } - - newp = talloc_named_const(t, size, name); - if (newp) { - memcpy(newp, p, size); - } - - return newp; -} - -/* - * alloc an array, checking for integer overflow in the array size. - * - returns NULL if count or el_size are zero. - */ - -void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name) -{ - if (count >= MAX_TALLOC_SIZE/el_size) { - return NULL; - } - - if (el_size == 0 || count == 0) { - return NULL; - } - - return talloc_named_const(ctx, el_size * count, name); -} - -/* - * alloc an zero array, checking for integer overflow in the array size - * - returns NULL if count or el_size are zero. - */ - -void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name) -{ - if (count >= MAX_TALLOC_SIZE/el_size) { - return NULL; - } - - if (el_size == 0 || count == 0) { - return NULL; - } - - return _talloc_zero(ctx, el_size * count, name); -} - -/* - * Talloc wrapper that returns NULL if size == 0. - */ -void *talloc_zeronull(const void *context, size_t size, const char *name) -{ - if (size == 0) { - return NULL; - } - return talloc_named_const(context, size, name); -} -#endif - /**************************************************************** strip off leading '\\' from a hostname ****************************************************************/ -- cgit